Sign in to follow this  

Linker can't find obvious main() definition

This topic is 3600 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

This topic is 3600 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this