Tuesday, 23 June 2009

Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup MSVCRTD.lib

This happens if you’re compile/run a Windows app that has a WinMain function, but you chose “Console Application” INSTEAD of
“Windows Application” when you were creating the new project.

You fix this by right clicking on your PROJECT name, then picking the PROPERTIES dialog:
Project Property pages

Then change the subsystem to WINDOWS:
unresolved.gif


NEXT TIME,

to prevent that from happening, make sure you pick WINDOWS APPLICATION at the point where Visual Studio asks you whether you want a console app or a windows app!:

basicwindowsprog1.gif

basicwindowsprog2.gif



5 comments:

  1. I do not see Subsystem on my Visual Studio 2008. What happens ?

    ReplyDelete
  2. I found it. It is under system under Linker. Thanks.

    ReplyDelete