编译时未找到 SDL2 headers os x

SDL2 headers not being found when compiling os x

我似乎无法编译这个程序。我的 class 中还有其他人在编译此代码时没有问题。我正在使用相同的命令来尝试编译程序并将框架安装在与它们相同的目录中。 /Library/Frameworks。我还安装了 eclipse 并按照 zamma.co.uk 教程设置 sdl2,但也没有用。这是编译

时我 运行 的命令

g++ -std=c++11 -o Gravity main.cpp Game.cpp Particle.cpp Point.cpp -I/Library/Frameworks/SDL2.framework/Headers-框架SDL2-框架Cocoa

注意:我都试过了

#include <SDL.h>

#include <SDL2/SDL.h> 

两者都不起作用

您在评论中提到的 ld 链接器错误表明您可能需要传递 -F 选项或 -L 以防找不到 features/library 搜索路径您的 SDL2 安装。

您的问题类似于:

  • linker command failed, sdl
  • How do you include files in C++ from the /Library/Framework folder in MAC