Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are the OpenGL header files located on MacOSX?

Tags:

macos

opengl

In /usr/include ,

I tried grepping for GL gl and OpenGL .. .but can't find it.

Where are these header files located?

like image 902
anon Avatar asked Feb 04 '10 03:02

anon


People also ask

Where are header files stored in Mac?

sdk . From there, usr/include holds common public headers such as the standard C headers, and various Apple headers are in frameworks under System . In /Applications/Xcode. app/Contents/Developer/Platforms , you will likely find folders for other platforms, such as iPhoneOS.


4 Answers

They are located at /System/Library/Frameworks/OpenGL.framework/Headers. To include them, just use:

   #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

like image 82
mbarnett Avatar answered Sep 27 '22 20:09

mbarnett


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.

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:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Headers

like image 40
Reto Koradi Avatar answered Sep 27 '22 20:09

Reto Koradi


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.

like image 41
Walter Nissen Avatar answered Sep 27 '22 19:09

Walter Nissen


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>

OpenGl is included <OpenGL/gl.h> rather than the more expected <GL/gl.h> on other platforms.

like image 25
Chris Becke Avatar answered Sep 27 '22 19:09

Chris Becke