Problem with Debugging of C++ Error

Started by
6 comments, last by 147 11 years, 8 months ago
I have some problem in finding a bug in an example application, but I had this problem several times before, when I worked with C++ applications. I receive the error LNK1120, and as the error of the external the error LNK2019 (Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup C:\Users\Simon\Programme\DirectX\DirectX11Framework\DirectX11Framework\MSVCRTD.lib(crtexe.obj) DirectX11Framework). The msdn documentation has several things, which could be the reason, but the main problem is, that I do not find the reason for this error. Is there any way to get more detailed information to an error and where it occurs. And perhaps anyone has an idea how to resolve it.
And a general question how can such "cryptic" errors be debugged, because the help on msdn is not that good in this aspect.
Advertisement
What is then example app? What entry point was used in relation of how the project is set up?
Basically the code compiled but the linker has errors.

"LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup C:\Users\Simon\Programme\DirectX\DirectX11Framework\DirectX11Framework\MSVCRTD.lib(crtexe.obj) DirectX11Framework"

MSVCRTD.lib is Microsoft C Runtime Library
Within the library or (crtexe.obj) the function __tmainCRTStartup() is trying to reference _main() which is non-existent.
Its to do with project settings, is it built in Unicode mode? Is it a console or windows app? You just need to feed the right info to the project settings
Under general in project default is the character set on Unicode. It is an console application.
I program after a tutorial of the internet (http://rastertek.com/dx11tut02.html), because tipping the code helps to understand it better, but it was nice, if it would work.
@Neometron if this is the case of the error, how could I resolve it?
LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

You don't have a main() function that matches what the linker expects.

Either this is because you never actually wrote a main() function, or because you are linking to the wrong libraries. Chances are it's the former.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Change it from Console to Windows App. Console Apps won't look for WinMain Entry point - thats judging from the URL you've passed on
I have a WinMain function. Should I rename it, or write a main function that calls the WinMain function?
@dimitri.adamou How can I change the application type to Windows Application?
The change from console to Windows application solved the problem.
I changed under Linker, System Subsystem to Windows - and it works.
Thanks for helping. :-)

This topic is closed to new replies.

Advertisement