FreeGLUT on Mac OS X Lion

jasonaburton picture jasonaburton · Jun 3, 2012 · Viewed 18.6k times · Source

Some context: I am going through a tutorial on using OpenGL. The tutorial requires a couple libraries in order to work. One of those libraries is FreeGLUT. I am on OS X using Lion.

I've downloaded FreeGLUT and followed the instructions for installation, but when I run the 'make all' command I get this error:

error: GL/gl.h: No such file or directory
error: GL/glu.h: No such file or directory

I've scoured the internet for a solution and all I've been able to understand from this is that the compiler is having trouble locating these files and that the path that the compiler is using needs to be changed.

EDIT: Okay, I've figured out that it's not the compiler, it is that for some reason those files are not there. Going to try figure out why they are not there.

Answer

Hassan picture Hassan · Jun 3, 2012

On Mac, the location of those header files are not the same as on Linux. So in the code, replace this:

#include <GL/gl.h>
#include <GL/glu.h>

with this:

#include <OpenGL/gl.h>
#include <OpenGL/glu.h>

and that should fix your issue.