Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program Compiles but Has a Link Error

Status
Not open for further replies.

OceanDesigner

Programmer
Oct 30, 2003
173
US
I have written a program in Visual C++ v5.0 as a Win32 Application. The program compiles but it will not link. The error is:

error LNK2001: unresolved external symbol _WinMain@16

which suggests that I may not have the correct preprocessor definitions or I am missing an include file. The simplest form of the code that gives me the error looks like this:

#include <stdio.h>
int main()
{
printf(&quot;Linked&quot;);
return 0;
} // END MAIN FUNCTION

I appreciate any help you can give me.

Jeff
 
It means you have created a Win32 type project. If you want to use main() you should create a Win32 console type project.
To correct error, create another project or put WinMain(.....) instead of main()

Ion Filipski
1c.bmp
 
Thanks. Using a win32 console application, I was able to get the program linked.

The rest of this may be moot, but I tried all sorts of things in the win32 application. WinMain() gives me the same error. Does WinMain() require parameters?

Also, I am a little confused about the type of projects. I guess I need to read up on that. Any good online references discussing what type of projects to use and when?

Thanks again, Jeff
 
the prototype of WinMain is
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)


Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top