我在 OS X El Capitan 上正确安装了 Homebrew 程序及其 sdl2 软件包,并且 SDL2 header 位于/usr/local/include/SDL2 中,但是当我在 gcc 和 #include <SDL2/SDL.h>
中使用 -lSDL2 时就像在 Linux 中一样,我收到错误 fatal error: 'SDL2/SDL.h' file not found
为什么会发生这种情况?我应该将/usr/local/include 符号链接(symbolic link)到/usr/include/吗?
最佳答案
你必须#include <SDL2/SDL.h>
gcc -I /Library/Frameworks/SDL2.framework/Headers -framework SDL2 your_file.c
该框架必须位于要搜索的库路径列表中
关于terminal - 如何通过 Makefile 在 OS X 上使用 SDL2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37147641/