..
SDL Configure MacOS
To configure SDL on MacOS, you need download it from https://github.com/libsdl-org/SDL/releases.
Choose the .dmg file for MacOS.
After open the .dmg file, move the SDL2.framework
to the folder /Library/Frameworks
.
Now, you can compile the program with:
clang ../src/main.cpp -Wall -g -o main -I/Library/Frameworks/SDL2.framework/Headers -F/Library/Frameworks -framework SDL2
But, maybe you can see the error:
dyld[1263]: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2 Referenced from: <E08993BF-C812-3864-AE0F-2D739FF864A6> /Users/tiagoaguiar/cpp/main/build/main Reason: no LC_RPATH's found [1] 1263 abort ../build/main
So, add the next line to add frameork path to the binary:
install_name_tool -add_rpath "/Library/Frameworks" main
Another way to get SDL library path and headers is using `sdl2-config --libs --cflags`
.