Jump to content
  • Advertisement
Sign in to follow this  

Linker can't find obvious main() definition

This topic is 3959 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup is what I get anytime I try to build my project. I've gone into Linker->System->SubSystem and set it to Windows, and that creates the same error (plus I want it to be console anyway...). I've tried recreating the project twice (with diff wizard settings each time), and it doesn't work. I should point out that I have a slightly different project that runs just fine, and I can't find one darn bit of difference between their configuration properties (I went through them ALL, one at a time). Any advice? Link to an explaination? Etc.?

Share this post

Link to post
Share on other sites
Here's the likely options where the money is at:

1) Mispelled "main" (e.g. different capitalization, such as "Main" -- C++ is case sensitive)

2) Bad signature for "main" -- should be:
int main() or
int main( void ) or
int main( int argc, char *argv[] ) or
int main( int argc, char **argv ) or
int _tmain( int argc, TCHAR *argv[] ) (IIRC) or
int _tmain( int argc, TCHAR **argv ) (IIRC)

3) Didn't link SDLmain.lib when using SDL (link it or #undef main after #include <SDL.h> in the file containing main())

Posting the source would have let me point out that it was definately one of these, or entertain farther fetched possibilities.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!