fatal error: SDL/SDL.h: No such file or directory [closed]

Solution 1:

Probably you have already installed the libraries, I show the steps but again for the reason of completeness.

  • SDL2

    sudo apt-get install libsdl2-dev
    
  • SDL1

    sudo apt-get install libsdl1.2-dev
    

Start the compilation with:

  • SDL2

    gcc cube.c `pkg-config --cflags --libs sdl2`
    
  • SDL1

    gcc cube.c `pkg-config --cflags --libs sdl`
    

Sample output:

% pkg-config --cflags --libs sdl               
-D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -lSDL

% pkg-config --cflags --libs sdl2
-D_REENTRANT -I/usr/include/SDL2 -lSDL2