Reputation: 43
I'm doing LazyFoo's SDLTutorial setup for VS2010 and I'm having trouble getting it to cooperate. What's strange is that I can get it to work seemingly fine on VS2008.
#include "SDL.h"
int main(int argc, char* argv[])
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Quit();
return 0;
}
This is the error messages that it gives me
1>MSVCRT.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>Visual Studio 2008\Projects\Test\Debug\Test.exe : fatal error LNK1120: 1 unresolved externals
I've followed the steps, step by step, at least 4 times at this point and I continue to get these errors. I'm considering going back to 2008 if I can't get this resolved, but I'd rather stay with 2010. Is there something I'm missing?
Upvotes: 1
Views: 7037
Reputation: 46
If you fail to include optional command line arguments in your main(), you will get errors when trying to compile anything that contains SDL2, so the proper solution is to always remember doing what Rafael said.
int main(int argc,char* argv[]){}
This resolves all the issues if you are sure you included the libraries properly.
Upvotes: 1
Reputation: 33
If you did that already and you are still getting the same error. It might be that you didnt write your main so that it allows command arguments. It should look like this.
int main(int argc,char* argv[]){ // your code here }
Upvotes: 1
Reputation: 2621
That means the linker cannot find the libraries. Double check the settings in
Project -> Properties -> Configuration Properties -> Linker
Specify the directory: General, Additional Library Directories: <path>\SDL2-2.0.3\lib\x86
and
Specify the files: Input, Additional Dependencies: SDL2.lib;SDL2main.lib;
Upvotes: 3