I am having difficulty compiling a C program using the OpenGL and GLUT frameworks on Mac OSX. I am just getting started and I attempted to run code from this tutorial, on how to install OpenGL. http://www.prinmath.com/csci5229/misc/install.html.
Here is the code:
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
int main(){
return 0;
}
I am trying to compile it with:
gcc -o foo foo.c -framework GLUT -framework OpenGL
I am receiving this error:
foo.c:2:23: error: GLUT/glut.h: No such file or directory
After doing some further research here, http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto/, I looked in /System/Library/Frameworks/ and both OpenGL.framework, and GLUT.framework where present.
Any help is greatly appreciated! Thank you!
Installing GLUTThere is no need to install GLUT on a Mac. It comes as part of the package. If you have XCode, you can make a GLUT application.
OpenGL is available to all Macintosh applications. OpenGL for OS X is implemented as a set of frameworks that contain the OpenGL runtime engine and its drawing software. These frameworks use platform-neutral virtual resources to free your programming as much as possible from the underlying graphics hardware.
Without installing glutg3-dev you can use OS X GLUT and OpenGL frameworks as follows
gcc -o foo foo.c -L/System/Library/Frameworks -framework GLUT -framework OpenGL
notice that it is important to tell the compiler the path to the frameworks
You need to install OpenGL Utility Toolkit glutg3-dev
lib.If it is already there then compile with -lglut -lGLU -lGL
option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With