Skip to content
Advertisement

‘”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?

Advertisement

Answer

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 ...
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement