Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

_printf error with visual c 1.52

Posted on 1998-05-31
4
475 Views
Last Modified: 2013-12-03
What causes this link problem ( _printf ) with Visual C 1.52 in this windows project & how can it be solved ?

#include <stdio.h>
#include <windows.h>

void main()
{
  printf("This is just a test");
}

Linking...

TRY.OBJ(c:\project\vc-c1_de.kit\vcc\vcc\try.c) : error L2029: '_printf' : unresolved external

 LINK returned error code 2.
4.EXE - 1 error(s), 0 warning(s)

0
Comment
Question by:sector
  • 3
4 Comments
 
LVL 11

Expert Comment

by:alexo
ID: 1405500
printf() needs a console to print to and Win16 does not support consoles.  Compile your project as QiuckWin (or something similar).
0
 

Author Comment

by:sector
ID: 1405501
i can't compile my program as a quickWindow application
because it is a CGI .

what other alternatives do i have ???
0
 
LVL 11

Accepted Solution

by:
alexo earned 20 total points
ID: 1405502
OK, first thing first: Native Win16 applications cannot use printf() for lack of a console.

Options:

1. Compile as a QuickWin application.  It "maps" the stdio to a window that simulates a console.  I have no idea why a CGI cannot be a QuickWin application, but then, I have no idea how a CGI is different from a "normal" application.

2. Compile it as a DOS application.  Obviously all functionality provided by Windows will be unavailable.  A DOS program can run under windows without a problem.

3. Move to Windows95/98/NT and compile the program as a console application.

4. Create a window and a DC in your application and use TextOut() APIs for output.

5. Create an edit box in your application and use EM_SETSEL and EM_REPLACESEL messages to display output.

To summarize:  Either compile for a platform that supports a console (QuickWin, Win32 or DOS) or manage the output yourself using Win16 APIs or controls.

0
 
LVL 11

Expert Comment

by:alexo
ID: 1405503
And the autograder hits again!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question