macos MacOSX 上的 OpenGL 头文件在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2197223/
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
Where are the OpenGL header files located on MacOSX?
提问by anon
In /usr/include ,
在 /usr/include 中,
I tried grepping for GL gl and OpenGL .. .but can't find it.
我尝试搜索 GL gl 和 OpenGL ......但找不到它。
Where are these header files located?
这些头文件在哪里?
回答by mbarnett
They are located at /System/Library/Frameworks/OpenGL.framework/Headers. To include them, just use:
它们位于 /System/Library/Frameworks/OpenGL.framework/Headers。要包含它们,只需使用:
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <OpenGL/glext.h>
#include <GLUT/glut.h>
etc. Make sure to link against the appropriate frameworks, eg)
等。确保链接到适当的框架,例如)
cc <your_file.c> -framework GLUT -framework OpenGL
for OpenGL and GLUT
对于 OpenGL 和 GLUT
回答by Reto Koradi
This is a good old thread to revive, because the correct answer changed. The accepted answer of /System/Library/Frameworks/OpenGL.framework/Headers
was totally correct when it was written. But with Xcode 5 (I believe it changed with Xcode 4 already), this is not the case anymore.
这是一个很好的旧线程,因为正确答案已更改。被接受的答案/System/Library/Frameworks/OpenGL.framework/Headers
在写的时候是完全正确的。但是对于 Xcode 5(我相信它已经随着 Xcode 4 改变了),情况不再如此。
All SDK files are now installed into /Applications/Xcode.app
. The exact location of the headers depends on the platform the application is built against. As an example, the OpenGL headers for OS X 10.9 are in:
所有 SDK 文件现在都安装到/Applications/Xcode.app
. 标头的确切位置取决于构建应用程序的平台。例如,OS X 10.9 的 OpenGL 头文件在:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Headers
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Headers
回答by Walter Nissen
It's worth noting that one also needs to have XCode itself set up (not just installed), as well as the XCode Command-Line Tools, even if one is not building the application in XCode.
值得注意的是,即使不是在 XCode 中构建应用程序,也需要设置 XCode 本身(不仅仅是安装)以及 XCode 命令行工具。
回答by Chris Becke
XCode automatically exposes all header files from a framework added to a project via the framework's name.
So, "cocoa.h"
is part of "cocoa.framework"
- hence #include <cocoa/cocoa.h>
XCode 会自动公开框架中通过框架名称添加到项目中的所有头文件。所以,"cocoa.h"
是"cocoa.framework"
- 因此的一部分#include <cocoa/cocoa.h>
OpenGl is included <OpenGL/gl.h>
rather than the more expected <GL/gl.h>
on other platforms.
包含 OpenGl<OpenGL/gl.h>
而不是<GL/gl.h>
其他平台上更多的预期。
回答by LarsH
In MacOS 10.12.6, they're under /opt/X11/include
, e.g. /opt/X11/include/GL/gl.h
.
在MacOS上10.12.6,他们是下/opt/X11/include
,例如/opt/X11/include/GL/gl.h
。