Cross-compile program can't find SDL2 headers

1.9k views Asked by At

I'm working on a project in c++ that uses autotools for easy cross-compile. I've sudo make install'd MXE on my system. When just using ./configure, and thus using g++, things run smoothly. However, using ./configure --host=i686-w64-mingw32, I run into this error:

In file included from Game.cpp:1:0:
Game.hpp:4:22: fatal error: SDL2/SDL.h: No such file or directory
#include <SDL2/SDL.h>

After fishing around Google all day, I can't seem to find an indicator as to why. I know that when compiling on Win(currently on Ubuntu 15.04), the headers are named differently for SDL, but I'm still using a Unix compiler, according to my understanding. Do I need to have separate source for Windows, with a different include? I monitored the mxe install for errors and received none, so I can't conceive of that being the issue.

If needed, I can provide a more complete picture of the environment, but I believe this to perhaps be an OS specific error/caveat.

1

There are 1 answers

2
Jean Pierre Dudey On

SDL2 headers should be included as follows:

#include <SDL.h>

Not:

#include <SDL2/SDL.h>

Why?

Because when you run sdl2-config --cflags its outputs a path like this include/SDL2 and if you do a ls on it you will get SDL.h not SDL2/SDL.h.