Jump to content

  • Log In with Google      Sign In   
  • Create Account


Problem with Debugging of C++ Error


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 147   Members   -  Reputation: 197

Like
0Likes
Like

Posted 12 August 2012 - 12:02 PM

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.

Sponsor:

#2 Neometron   Members   -  Reputation: 313

Like
0Likes
Like

Posted 12 August 2012 - 12:35 PM

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.

#3 dimitri.adamou   Members   -  Reputation: 329

Like
0Likes
Like

Posted 12 August 2012 - 05:54 PM

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

#4 147   Members   -  Reputation: 197

Like
0Likes
Like

Posted 13 August 2012 - 11:07 AM

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?

#5 ApochPiQ   Moderators   -  Reputation: 14666

Like
0Likes
Like

Posted 13 August 2012 - 11:12 AM

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.

#6 dimitri.adamou   Members   -  Reputation: 329

Like
1Likes
Like

Posted 13 August 2012 - 03:51 PM

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

#7 147   Members   -  Reputation: 197

Like
0Likes
Like

Posted 15 August 2012 - 01:20 AM

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?

#8 147   Members   -  Reputation: 197

Like
0Likes
Like

Posted 16 August 2012 - 12:19 PM

The change from console to Windows application solved the problem.
I changed under Linker, System Subsystem to Windows - and it works.
Thanks for helping. :-)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS