简体   繁体   中英

Cross-compile program can't find SDL2 headers

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM