Reputation: 932
I installed SDL2 on Mac OSX 8.4 following the guide here: https://stackoverflow.com/a/12473310
I had to change the prefix "/home/user/SDL" to "/Users/agargara/programming/SDL/" because /home is just a placeholder in OSX 8.4 ― there's no permission to make folders in that directory without a bit of hacking.
I was able to compile a test file with the following:
g++ Main.cpp -o main -I/Users/agargara/programming/SDL/include/SDL2 -L/Users/agargara/programming/SDL/lib -lSDL2main -lSDL2 -framework OpenGL -framework Cocoa
However, running gives the following error:
dyld: Library not loaded: /home/user/SDL/lib/libSDL2-2.0.0.dylib
Referenced from: /Users/agargara/programming/SDL-tut/01_hello_SDL/./hello
Reason: image not found
Trace/BPT trap: 5
I assume this is because somewhere, the library is still trying to use the incorrect prefix /home/user/. What do I need to change to fix this?
Upvotes: 2
Views: 6283
Reputation: 932
Well, with a bit more fiddling I got lucky and answered my own question! Rather than compiling from source, I needed to download the Development Library for OSX and copy it into /Library/Frameworks/.
Once that was finished, the correct method to compile was simply:
g++ Main.cpp -o main -I/Library/Frameworks/SDL2.framework/Headers -framework SDL2 -framework Cocoa
Upvotes: 6