我似乎无法编译这个程序。 我班上有其他人编译这段代码没问题。 我正在使用相同的命令来尝试编译程序并将框架安装在与它们相同的目录中。 /库/框架。 我还安装了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 -framework SDL2 -framework Cocoa
注意:我试过了两个
#include <SDL.h>和
#include <SDL2/SDL.h>并且都不起作用
I can't seem to compile this program. I have other people in my class that are having no problem compiling this code. I'm using the same command to try to compile the program and installed the frameworks in the same directory as them. /Library/Frameworks. I also installed eclipse and followed the zamma.co.uk tutorial to setup sdl2 and that didn't work either. Here is the command i'm running when compiling
g++ -std=c++11 -o Gravity main.cpp Game.cpp Particle.cpp Point.cpp -I/Library/Frameworks/SDL2.framework/Headers -framework SDL2 -framework Cocoa
Note: I have tried both
#include <SDL.h>and
#include <SDL2/SDL.h>and neither work
最满意答案
您在注释中提到的ld链接器错误表明,如果您的功能/库搜索路径未找到SDL2安装,则可能需要传递-F选项或-L 。
您的问题听起来类似于:
链接器命令失败,sdl 如何在MAC中的/ Library / Framework文件夹中包含C ++文件The ld linker error you mention in your comments suggests you may need to pass the -F option or -L in case your features/library search path is not finding your SDL2 installation.
Your problem sounds similar to:
linker command failed, sdl How do you include files in C++ from the /Library/Framework folder in MAC更多推荐
发布评论