MSVCRTD.lib(crtexew.obj): error LNK2019: Unresolved external symbol _WinMain@16, this symbol is referenced in the function ___tmainCRTStartup
Debug\jk.exe: fatal error LNK1120: 1 unresolved external command
error LNK2001: unresolved external symbol _WinMain@16
debug/main.exe: fatal error LNK 1120:1 unresolved externals
error executing link.exe;
The real reason for this problem is that the proper program entry function cannot be found when the C language is running.
Under normal circumstances, if it is a windows program, then WinMain
is the entry function, and the new project in VS2008
is win32 project
If it is a DOS console program, then `main` is the entry function, and the new project in VS2008
is win32 console application
And if the entry function is not specified properly, obviously it will report an error if it cannot find the matching function when the c language is running.
Modify the settings to suit your needs
If it is a windows program:
Project->Properties
in the menu, and the Property Pages
window will pop upConfiguration Properties->C/C++->Preprocessor
, then delete _CONSOLE
from the corresponding item of Preprocessor Definitions
in the right column, and add _WINDOWS
.Configuration Properties->Linker->System
, and then the corresponding item of SubSystem
in the right column is changed to Windows(/SUBSYSTEM:WINDOWS)
If it is a console program:
Project->Properties
from the menu, and the Property Pages
window will pop upConfiguration Properties->C/C++->Preprocessor
, then delete _WINDOWS
from the item corresponding to Preprocessor Definitions
in the right column, and add _CONSOLE
.Configuration Properties->Linker->System
, and then the corresponding item of SubSystem
in the right column is changed to CONSOLE(/SUBSYSTEM:CONSOLE)