terminal - 如何通过 Makefile 在 OS X 上使用 SDL2?

标签 terminal homebrew gcc

我在 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/

相关文章:

linux - 如何更改 mac 文件夹权限?

linux - 通过命令 shell 脚本使用 tshark 进行转换

c++ - GCC 和 MS 编译器的模板实例化细节

c - errno 是线程安全的吗?

c - GCC Atomic Builtins 而不是 pthread?

c - 终端中的 .txt 文件扩展名

macos - 删除终端中新选项卡的 "Last login"消息

java - 如何用 brew 安装 openjdk?

c - Mac proj.4 编译错误

ssh - brew 安装 sshfs