Thanks for all the answers. That link was very useful manasij.
I managed to install SDL and have been able to comile and run a few "very" basic examples. However I am running into compiler errors whenever I use SDL_SetVideoMode(). It's fourth argument is a flag and these flags are not being understood by the compiler (at least thats my best guess). Take this code for example:
Code:
/* Includes */#include <SDL2/SDL.h>
/* Globals */
SDL_Surface *demo_screen;
/* Main */
int main(int argn,char **argv)
{
SDL_Event ev;
int active;
/* Initialize SDL */
if(SDL_Init(SDL_INIT_VIDEO) != 0)
fprintf(stderr,"Could not initialize SDL: %s\n",SDL_GetError());
/* Open main window */
demo_screen = SDL_SetVideoMode(320,240,0,SDL_HWSURFACE|SDL_DOUBLEBUF);
if(!demo_screen)
fprintf(stderr,"Could not set video mode: %s\n",SDL_GetError());
/* Main loop */
active = 1;
while(active)
{
/* Handle events */
while(SDL_PollEvent(&ev))
{
if(ev.type == SDL_QUIT)
active = 0; /* End */
}
}
/* Exit */
SDL_Quit();
return 0;
}
Im getting an error at line 16.
Code:
Trying_SDL.c: In function ‘main’:
Trying_SDL.c:16: error: ‘SDL_HWSURFACE’ undeclared (first use in this function)
Trying_SDL.c:16: error: (Each undeclared identifier is reported only once
Trying_SDL.c:16: error: for each function it appears in.)
Trying_SDL.c:16: error: ‘SDL_DOUBLEBUF’ undeclared (first use in this function)
Everything else works except for "all" the flags for SDL_SetVideoMode(). What could be the cause of this? All SDL programs that do not use this function seems to be working perfectly.
Edit: Im compiling with gcc, with -lSDL2
Any help appreciated.