argoneus argoneus - 1 year ago 122
C++ Question

'"SDL.h" no such file or directory found' when compiling

Here's a piece of my current Makefile:

CFLAGS = -O2 -Wall -pedantic -std=gnu++11 `sdl-config --cflags --libs` -lSDL_mixer

I have libsdl installed properly, SDL.h is in /usr/include/sdl where it belongs, but it just won't compile. I also have the line
#include "SDL.h"
in my .h files, but still no go.

Anyone knows why?

Answer Source

If the header file is /usr/include/sdl/SDL.h and your code has:

#include "SDL.h"

You need to either fix your code:

#include "sdl/SDL.h"

Or tell the preprocessor where to find include files:

CFLAGS = ... -I/usr/include/sdl ...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download