Tuesday, August 5, 2008

Change VC++ Win App to Console App

To change the windows application in Visual C++ to console after change the name of WinMain method to another name to prevent the linker to set it as entry point and add a main method you may get the error:
LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

So you need another change in your project properties:
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

No comments: