   A little trouble initializing SDL
  Hi :)I hope you can help me. I am trying to get started with SDL in C++ and Visual C++ 2005 express edition.I have this short code:#include "sdl\SDL.h"int main(){SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO);atexit(SDL_Quit);return 0;}Which I think should compile normally but I get these error messages:------ Build started: Project: SDL_tests, Configuration: Debug Win32 ------Compiling...main.cppLinking...main.obj : error LNK2019: unresolved external symbol _SDL_Quit referenced in function "int __cdecl SDL_main(void)" (?SDL_main@@YAHXZ)main.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function "int __cdecl SDL_main(void)" (?SDL_main@@YAHXZ)LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartupC:\Documents and Settings\Kristinn Esmar\My Documents\Visual Studio 2005\Projects\SDL_tests\Debug\SDL_tests.exe : fatal error LNK1120: 3 unresolved externalsBuild log was saved at "file://c:\Documents and Settings\Kristinn Esmar\My Documents\Visual Studio 2005\Projects\SDL_tests\SDL_tests\Debug\BuildLog.htm"SDL_tests - 4 error(s), 0 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========Anyone have any idea what is wrong?   
  You have your int main() function declared incorrectly.For reasons that have been explained to me multiple times that I always forget([smile]), you must create you main() function as:int main(int argc, char* args[])Hope that is what you were looking for.   ;  I changed it to int main(int argc, char* args[])but I still get the exact same errors.   ;Quote:Original post by Servant of the LordYou have your int main() function declared incorrectly.For reasons that have been explained to me multiple times that I always forget([smile]), you must create you main() function as:int main(int argc, char* args[])Hope that is what you were looking for.SDL does some funky name mangling so that your main becomes SDL_main and SDL actually does your main...  So if you don't do (int, char**) SDL won't know to replace it and thus would give errors.Also, did you link to SDL.lib and SDLmain.lib:#pragma comment(lib, "SDLmain.lib")#pragma comment(lib, "SDL.lib")// at the very top   ;  Yes you must change your main function.  If those same error messages come up then...it seems like some stuff is linked wrong.  Check how you are linking them  There are 2 possible mains.  They are as followed:int main(int argc, char* argv[]);...//orint main(int argc, char** argv);I hope that helps.Chad.   ;  I've changed the category to multithreaded dll, told it not to use precompiled headers and changed the code to this:#include "SDL.h" int main( int argc, char* args[] ) { //Start SDL SDL_Init( SDL_INIT_EVERYTHING ); //Quit SDL SDL_Quit(); return 0; }now I only get one error...LINK : fatal error LNK1561: entry point must be definedDoesnt seem to work :*(   ;Quote:Original post by Anonymous PosterI've changed the category to multithreaded dll, told it not to use precompiled headers and changed the code to this:#include "SDL.h" int main( int argc, char* args[] ) { //Start SDL SDL_Init( SDL_INIT_EVERYTHING ); //Quit SDL SDL_Quit(); return 0; }now I only get one error...LINK : fatal error LNK1561: entry point must be definedDoesnt seem to work :*(Did you add the #pragmas like I said above?   ;  yeah, it didnt change anything.. I also tried putting the libs in as additional dependencies.   ;  Try creating a new blank project. Are you making a Win32 app or console?   ;  Ahh.. I started a new application... The earlyer one was an empty one.. Now I started a console app (win32) and it works when I add the libs as dependancies. Thanks guys for your help :)   