fatal error: SDL/SDL.h: No such file or directory [closed]
I am trying to practice lesson_1 at
When I run the code named cube.c I got
cube.c:16:21: fatal error: SDL/SDL.h: No such file or directory #include <SDL/SDL.h> ^
compilation terminated.I've installed SDL2 with guidance at
I am using 14.04 though..
The installation of SDL2 was successful I did not get any error.
The SDL.h file is located in "/usr/local/include/SDL2"
I tried to force to use fullpath linking by command
gcc cube.c -lglut -lGL -lGLU -l/usr/local/include/SDL2instead of
gcc cube.c -lglut -lGL -lGLU -lSDLBut all were in vain...
Does anybody know solution for this linking problem?
As what muru pointed out I changed to captial i got "error: unknown type name ‘SDL_keysym’" meaning worked.
Other way I discovered was
I changed
#include <SDL/SDL.h> to
#include <SDL2/SDL.h>No longer shows "fatal error: SDL/SDL.h: No such file or directory" Thus for now consider solved. However I am getting the following errors that will be posting on separate thread.
cube.c:105:22: error: unknown type name ‘SDL_keysym’ void handleKeyPress( SDL_keysym *keysym ) ^
cube.c: In function ‘main’:
cube.c:239:5: error: unknown type name ‘SDL_VideoInfo’ const SDL_VideoInfo *videoInfo; ^A.B.: I pasted output of your suggested commands below.
gcc cube.c `pkg-config --cflags --libs sdl`
Package sdl was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sdl' found
gcc cube.c `pkg-config --cflags --libs sdl2`
cube.c:105:22: error: unknown type name ‘SDL_keysym’ void handleKeyPress( SDL_keysym *keysym ) ^
cube.c: In function ‘main’:
cube.c:239:5: error: unknown type name ‘SDL_VideoInfo’ const SDL_VideoInfo *videoInfo; ^
errors continue.... 3 1 Answer
Probably you have already installed the libraries, I show the steps but again for the reason of completeness.
SDL2
sudo apt-get install libsdl2-devSDL1
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 2