SDL.h: No such file or directory

I installed libsdl 1.2 -dev on my Ubuntu, but the problem is that it does not understand #include<SDL.h>

And he says:

 SDL.h: No such file or directory 

But when I print:

 kit0n@ubuntu :~$ g++ sepand.cpp -o sepand -lSDL 

The project compiles without any problems. What should I do to make Ubuntu understand SDL.h?

+4
source share
1 answer

The correct way is to add `sdl-config --cflags` to your CXXFLAGS. (You should also add `sdl-config --libs` to your LIBS, even if this does not seem appropriate to you in your case.)

To paraphrase the link: use the output of the sdl-config --cflags --libs for SDL 1.2 or sdl2-config --cflags --libs for SDL2, for example:

 gcc -o test test.c `sdl-config --cflags --libs` 
+6
source

All Articles