xcode 包含语句:找不到 SDL/SDL.h 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19150739/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Include statement: can't find SDL/SDL.h file
提问by bernie2436
My understanding is that when I build a C++ project in xcode and I have an include line in one of my C files in angle-bracket formthen the C++ compiler that works with xcode looks in /System/Library/Frameworks/
to find the file. I think that because of this answer: when I use the line #include <OpenGL/gl.h> in my xcode project, where does it look for the gl.h file?
我的理解是,当我在 xcode 中构建 C++ 项目并且在我的一个 C 文件中以尖括号形式包含一行时,与 xcode 一起使用的 C++ 编译器/System/Library/Frameworks/
会查找该文件。我认为因为这个答案:当我在我的 xcode 项目中使用 #include <OpenGL/gl.h> 行时,它在哪里查找 gl.h 文件?
I have an SDL.h file at /System/Library/Frameworks/SDL.framework/headers/SDL.h
(I downloaded the folder SDL.framework and copied it to that location with the command sudo cp -r /Volumes/SDL/SDL.framework System/Library/Frameworks
)
我有一个 SDL.h 文件/System/Library/Frameworks/SDL.framework/headers/SDL.h
(我下载了文件夹 SDL.framework 并使用命令将其复制到该位置sudo cp -r /Volumes/SDL/SDL.framework System/Library/Frameworks
)
But my include statement in one of the files in my xcode project still gives this error:
但是我在我的 xcode 项目中的一个文件中的 include 语句仍然给出了这个错误:
#include <SDL/SDL.h> //throws file not found
Did I properly install the SDL framework? Why doesn't xcode see it?
我是否正确安装了 SDL 框架?为什么 xcode 看不到它?
回答by microslop
Under your projects Build Settings, do a search for "search". Add a header search path to the SDL directory /System/Library/Frameworks/SDL.framework/headers
在您的项目Build Settings 下,搜索“search”。添加标头搜索路径到 SDL 目录/System/Library/Frameworks/SDL.framework/headers
Should be able to just do this after:
应该能够做到这一点之后:
#include <SDL.h>
Hope that works for you.
希望这对你有用。
You can also check out this link: http://meandmark.com/blog/2012/01/using-sdl-with-xcode-4/
您还可以查看此链接:http: //meandmark.com/blog/2012/01/using-sdl-with-xcode-4/
It's for Xcode 4, but it looks like all the pieces are there.
它适用于 Xcode 4,但看起来所有的部分都在那里。