编译os x时找不到SDL2头文件(SDL2 headers not being found when compiling os x)

系统教程 行业动态 更新时间:2024-06-14 16:59:46
编译os x时找不到SDL2头文件(SDL2 headers not being found when compiling os x)

我似乎无法编译这个程序。 我班上有其他人编译这段代码没问题。 我正在使用相同的命令来尝试编译程序并将框架安装在与它们相同的目录中。 /库/框架。 我还安装了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

更多推荐

本文发布于:2023-04-17 08:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/11b6d46cec3aac6f95f4fb0f98860f49.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   头文件   os   compiling   headers

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!