安装SDL2库
- brew install sdl2
- pro添加库(库路径用brew info sdl2查看)
LIBS += -L/usr/local/Cellar/sdl2/2.0.10/lib/ -lSDL2-2.0.0
INCLUDEPATH += /usr/local/Cellar/sdl2/2.0.10/include
- 使用
#include<SDL/SDL.h>后直接使用
设置动态库加载路径
在pro中添加:
# set RPATH (place to look for .dylib & framework by default设置加载库的路径)
QMAKE_RPATHDIR += @executable_path/../Frameworks
QMAKE_RPATHDIR += @executable_path/lib