You must also
#pragma comment(lib, "SDLmain.lib")
Make sure that you have set these settings in your project:
http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet2010e/index.php
Also: my non-compilable example code above uses SDL_image but SDL_image is not part of the standalone SDL, it is an additional header file that allows some greater flexibility requiring image file types, etc. . So -- sorry to have gotten you confused, at the time of writing I supposed that it was apparent that the code was portraying structure and was not readily compilable.
If your project is set up properly and your additional dependencies and other settings are correct, this should compile fine:
1 2 3 4 5 6 7 8 9 10 11
|
#include <SDL.h>
int main( int argc, char* args[] )
{
//Initialize SDL
SDL_Init( SDL_INIT_EVERYTHING );
//Quit SDL
SDL_Quit();
return 0;
}
|
If this doesn't compile, there's something left to be added in your project settings.
Try it out.
EDIT:
SDL requires SDL.lib and SDLmain.lib to be added in Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies (or requires using the
#pragma comment
commands for "SDL.lib" and "SDLmain.lib").
Furthermore, make sure that SDL's include directory is added in:
Project Properties -> Configuration Properties -> VC++ Directories -> Include Directories
and also add SDL's lib directory in Project Properties -> Configuration Properties -> VC++ Directories -> Library Directories. Steps 3-8 in the tutorial I linked for setting up SDL in Visual Studio describe this process.