Solved

_printf error with visual c 1.52

Posted on 1998-05-31
4
477 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

679 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