1

I have been unable to compile a basic class file to generate a window using SDL2, using both brew and compiling from the SDL site using using...

 #include <SDL2/SDL.h>

at the top of the file.

Have also used...

#include <SDL/SDL.h>
#include "SDL"

among others and nearly always get this error

./src/window.cpp:1:10: fatal error: 'SDL2/SDL.h' file not found
#include <SDL2/SDL.h>

Something should have worked and just hasn't.

mada360
  • 31
  • 5
  • Please check my answer here, it's related to Xcode but the `sdl-config` part is the same, since you need to add the include path for compiling and the library for linking: http://stackoverflow.com/questions/28016258/using-homebrew-installed-sdl2-with-xcode/28016333#28016333 – Jack Feb 19 '15 at 01:35
  • 1
    Compiler Command? Are you using the proper linker flags? The linker flag you need is probably `-lsdl2`. – HSchmale Feb 19 '15 at 01:37
  • Passing `'sdl2-config --cflags --libs'` to g++ worked for me. – Emil Laine Feb 19 '15 at 01:42
  • The code compiles using `'sdl2-config --cflags --libs'` but using that and linking the object file in one step, when running the output simply outputs `Killed: 9`. If I run the compile and linking stages separate however it seems to be unable to find the SDL files again stating there are undefined symbols and a list of the SDL functions. – mada360 Feb 19 '15 at 17:05

0 Answers0