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:
Then change the subsystem to WINDOWS:
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!:
21 Comments
This helped – thanks!
Thank you!
I am new in this deal.
You helped me.
thank you, Bobobobo.
This is excellent. Thank you for taking the time to include the images. This is far more detail than I ever expected.
Thank you~!
Wahooo thank you! I have been trying for two days to figure out what was wrong with my code, I read other explanations of the error message that said the same thing but I only changed the project options and that didn’t work. Your pictures showing how to create a new GUI project did the trick :) Phew…
Thank you!!!
dont works!!!
not work
i tried the two options but this doesn’t work…any idea? :(
great workaround..:)..
Hi … I have two libraries in my project. The first library gets compiled and links without any problem. But I face the above problem while compiling second library and when I changed my application to windows, I see a different linking error now which is “msvcrt.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup” ..any idea how to resolve this ?
Thanks
<—- Slaps self in face
That helped me out.
Thanks man =]
Thank you! good job
thank’s a lot..
really helpful – thanks alot
thanks for helping me out, still have a long way to go to get to know my compiler better, thank you :D
It was an excellent one. Thanks man.
it don,t work
Thanks man!
One Trackback/Pingback
[…] way to AVOID this problem is at the time when you choose a project type. The project type should be of type Win32 Project and NOT Win32 Console Application. If Win32 is chosen the error should not bother […]