I am trying to practice lesson_1 at https://tutorialsplay.com/opengl/2014/04/23/textured-cube/
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 https://github.com/PluginIO/EX3/wiki/Setting-up-SDL2-in-Ubuntu-12.10
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/SDL2
instead of
gcc cube.c -lglut -lGL -lGLU -lSDL
But 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....
-l
is a linker option. To add include directories, use-I
(capital i). Also, why didn't you just installlibsdl1.2-dev
? – muru May 20 '15 at 21:57