Thanks John,

So having -lglut did the trick however I'm getting the following error with this sample code (truncated to the relevant part)


glutInit(&argc, argv);

glutInitContextVersion(4, 0);




glutInitWindowSize(CurrentWidth, CurrentHeight);


WindowHandle = glutCreateWindow(WINDOW_TITLE_PREFIX);


freeglut  ERROR:  Function <glutSetOption> called without first calling 'glutInit'.

On Thu, Jul 28, 2011 at 1:39 PM, Fay, John F Dr CTR USAF AFMC AAC/XRS <> wrote:

       One comment is that I find it rather surprising that Apple would
put its OpenGL include files in a non-standard bottom-level directory.

       A second and more pertinent comment is that the "-framework
GLUT" may point to a different "libglut" library file than the one which
you just built.  I don't know whether the four undefined symbols you
listed are all of them or just the first four, but three of them are not
standard GLUT.  If none of the "freeglut" functions are defined, you may
need to include a "-lglut" argument on your command line.

John F. Fay
Technical Fellow, Modeling and Simulation
Jacobs Technology / TEAS Group
P.O. Box 1935, Eglin AFB, FL  32542-5000

-----Original Message-----
From: Jon Keon []
Sent: Thursday, July 28, 2011 7:54 AM
Subject: [Freeglut-developer] Setting Up FreeGlut on a Mac with Eclipse

Hi All,

I'm having a heck of a time trying to get FreeGlut up and running on my
Mac using Eclipse CDT and I was hoping I could get some help.

I downloaded the tar for 2.6.0 and had to follow the instructions here
in order for it to properly extract and make without errors.
tar -xzf freeglut-2.6.0.tar.gz
cd freeglut-2.6.0
CPPFLAGS="-I/usr/X11R6/include" ./configure --prefix="${PWD}/../"
make install

This created two directories, once called include and one called lib. In
the include there is the GL folder with freeglut_ext.h, freeglut_std.h,
freeglut.h and glut.h. In the lib folder there is libglut.3.dylib,
libglut.a, libglut.dylib and

So naturally in Eclipse I pointed the include directory to the include
folder and added the lib folder to library paths.

This allowed me to include freeglut.h properly but when i went to build
it would error since it couldn't find GL/gl.h and GL/glu.h.

Since I'm on a mac, those files are part of the OpenGL framework on the
OS so i modified the freeglut_std.h so it reads:

#if defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GL/gl.h>
#include <GL/glu.h>

This fixed the include build error but now I have the following errors
which seems like the linker is not finding the libraries properly. Can
anyone help me out with what to do next?

make all

Building target: CPPHelloWorld

Invoking: MacOS X C++ Linker

g++ -L/OpenGL/FreeGlut_2.6.0_Release/lib -framework OpenGL -framework
GLUT -framework Cocoa -o "CPPHelloWorld"  ./src/CPPHelloWorld.o

Undefined symbols:

 "_glutInitContextProfile", referenced from:

     Initialize(int, char**)in CPPHelloWorld.o

 "_glutSetOption", referenced from:

     Initialize(int, char**)in CPPHelloWorld.o

 "_glutInitContextFlags", referenced from:

     Initialize(int, char**)in CPPHelloWorld.o

 "_glutInitContextVersion", referenced from:

     Initialize(int, char**)in CPPHelloWorld.o

ld: symbol(s) not found

collect2: ld returned 1 exit status

make: *** [CPPHelloWorld] Error 1

Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
Freeglut-developer mailing list