LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

웹서핑하다가 좋은팁이 있어서 올립니다.

(Win32 project - empty project 로 생성 후, 빌드시 만나 볼수 있는 LNK2019에 대한 대처법입니다.)

 

When trying to compile a command line (non-GUI) program with Visual Studio I got the error:

LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

I’ve had this before and so have lots of others – it’s a continual question out there on the web – this is to provide at least one answer hopefully.

I went to:

Project  Properties -> Linker -> System -> SubSystem

and set it to

Console (/SUBSYSTEM:CONSOLE)

rather than

Windows (/SUBSYSTEM:WINDOWS)

That suggested to the linker that maybe the program entry point should be “main” rather than “WinMain”

by JNexOnSoft 2014. 2. 13. 14:39