Let’s say you’ve created a Win32 Console Application in Visual Studio:
We get the classic main function.
Now suppose that after working on the project for a while we want to turn the app into a Windows app – no console. At first, this seems easy: just replace the main function with a proper WinMain:
Unfortunately, that’s not enough. Building the project produces the following linker error:
MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
The linker still expects a main function.
The solution is (apart from creating a new project, adding the files, making any changes to the project again) is to switch the subsystem by using the Linker / System property tab and changing SubSystem to Windows (instead of Console):
And voila! The project links successfully.