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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: Unresolved external '_main'

Status
Not open for further replies.

rpk2006

Technical User
Apr 24, 2002
225
IN
I am new to C under Windows. Whenever I try to run the following program under BC++ 5 or VC++ 6, it displays following error:

---------------------
#include <windows.h>

int _stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdline, int nCmdShow)
{
MessageBox(0,"Hello","First",0);
return 0;
}
----------------------

Error: Unresolved external '_main' referenced from D:\BC5W2K\LIB\C0X32.OBJ
 
WinMain is the entry point for GUI (or windows) programs
main is the entry point for console (or command line) programs

You need to tell your compiler to compile a GUI program and not a console program.

Exactly how you do that, you'd have to read the manual pages or help for those compilers you have.

The easiest way for VC++ is perhaps to use the IDE to create an empty GUI project, then copy your code into it. Then you can be sure that all the correct switches and libraries have been selected.

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top