SepanD
SepanD

Reputation: 137

SDL.h: No such file or directory

I've installed libsdl 1.2 -dev on my Ubuntu but the problem is that it doesn't understand #include<SDL.h>

And it says:

SDL.h: No such file or directory

But when i type:

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

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

Upvotes: 4

Views: 9543

Answers (1)

Fabel
Fabel

Reputation: 1761

The correct way is to add `sdl-config --cflags` to your CXXFLAGS. (You should also add `sdl-config --libs` to your LIBS even thou it doesn't seem to be needed in your case.)

Paraphrasing from the link: use the output of the command 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`

Upvotes: 6

Related Questions