我目前正在尝试遵循 OpenGL 介绍指南 此处。我已经将完成的项目直接从网站上的 git 存储库拉到一个新的 Xcode 项目中,但在尝试构建和运行时,我得到一个“GL/glew.h:没有这样的文件或目录”。
我已经从网站下载了glew,并运行“make”和“make install”。我可以在/usr/lib中看到3个libGLEW文件,在/usr/include/GL中看到3个与header glew相关的头文件。这一切都让我相信它安装得很好。
根据谷歌搜索的一些想法,我尝试将 /usr/lib 和 /usr/include/GL 路径添加到项目信息中的相关搜索路径,但这仍然给出了相同的问题。我还尝试将“-lGLEW”添加到“其他链接器标志”选项中。
C 源代码中的包含只是
#include <GL/glew.h>
我缺少什么?!
感谢您的帮助
接受的答案有效,XCode 中的递归框也需要选中。
I'm currently trying to follow the OpenGL intro guide here. I've pulled the finished project straight from the git repo on the site into a new Xcode project, but upon trying to build and run I get a "GL/glew.h: No such file or directory".
I've downloaded glew from the site, and run "make" and "make install". I can see 3 libGLEW files in /usr/lib, and 3 header glew related header files in /usr/include/GL. This all leads me to believe it's installed fine.
Following a couple of ideas from googling, I tried adding the /usr/lib and /usr/include/GL paths to the relevant search paths in the project info, but that still gave the same problem. I also tried adding "-lGLEW" to the 'Other Linker Flags' option.
The include in the C source is simply
#include <GL/glew.h>
What am I missing?!
Thanks for any help
Accepted answer works, the recursive box in XCode also needs to be checked.
发布评论
评论(1)
如果您使用
#include
来#include
,那么搜索路径必须是简单的/usr/include
。尝试将/usr/include
添加到 Xcode 项目中的标头搜索路径中,然后它应该能够找到标头。If you
#include
it using#include
then the search path has to be simply/usr/include
. Try adding/usr/include
to your header search paths in your Xcode project and then it should be able to find the header.