Wednesday, June 24, 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



10 comments:

JoeJoe said...

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

JoeJoe said...

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

Muralidharan said...

Thanks buddy!!

Bentsi said...

Thanks!!!

heshamwhite said...

Thanks,Jimey on he spot

Paritosh Parmar said...

great yaar !!!

Unknown said...

Good one ! Solved my Issue !

Unknown said...

i've changed it but i still getting the same error :( what can i do ? please

Anonymous said...

You guys are the best, could have spent eternity
trying to track down this error

Anonymous said...

2 days after investigating, your answer resolved my issue. Thanks!