View Full Version : FreeGLUT make all, make install commands

07-22-2014, 12:20 AM
I followed the directions from the website where you download free glut.

It seems to configure ok. However, when I try the make al or make install commands I get this error:

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1
make[1] *** [libglut.la] Error 1
make: *** [instal-recursive] Error 1

Is there a different install process for Mac OS X 10.9?
I've already tried the instructions on Lazy Foo which gave similar results.

07-23-2014, 04:47 AM
The linker is complaining that a symbol (e.g. function) was specified in the program (e.g. in a header file), but the object (e.g. code) specifying it cannot be found when you link. This probably you are not linking a library you should be when you compile. You should post the output which contains a segment called: "Undefined reference to ________" so we know can help you find what library you didn't include.

Ensure that when you ran ./configure, you ran the whole line from lazy foo
env CPPFLAGS="-I/opt/X11/include" LDFLAGS="-L/opt/X11/lib" ./configure.

While downloading direct from a source and fixing code yourself is all well and good, I confused why Lazy Foo is trying to you have you install freeglut that way. I'd try homebrew (http://brew.sh/) or macports (https://www.macports.org/) (freeglut is available on macports). With macports instead of doing all the
make all && make install, you just do
sudo port install freeglut and go.

07-23-2014, 06:03 PM
Wow! Thank you! MacPort made it SUPER EASY!!! I even found glew!

Is there something else I need to do? I followed Lazy foo's instructions to set up in Xcode but, it can't find free glut when i say:
#include <OpenGL/freeglut.h>

07-23-2014, 08:19 PM
Looking at it now and having done it a few minutes ago, you don't really even need freeglut.

Create a new Xcode command line project like LazyFoo says. HOWEVER, no additional linker flags are needed. In "build phases" tab under the project add the GLUT and OpenGL frameworks. Copy/paste this into your main.cpp. I just merged all the LazyFoo code.

#include <GLUT/glut.h>
#include <OpenGL/OpenGL.h>
#include <cstdio> //if you are using straight C, this should be stdio.h

//Screen Constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_FPS = 60;

bool initGL()
//Initialize Projection Matrix
glMatrixMode( GL_PROJECTION );

//Initialize Modelview Matrix
glMatrixMode( GL_MODELVIEW );

//Initialize clear color
glClearColor( 0.f, 0.f, 0.f, 1.f );

//Check for error
GLenum error = glGetError();
if( error != GL_NO_ERROR )
printf( "Error initializing OpenGL! %s\n", gluErrorString( error ) );
return false;

return true;

void update()


void render()
//Clear color buffer

//Render quad
glBegin( GL_QUADS );
glVertex2f( -0.5f, -0.5f );
glVertex2f( 0.5f, -0.5f );
glVertex2f( 0.5f, 0.5f );
glVertex2f( -0.5f, 0.5f );

//Update screen

void runMainLoop( int val )
//Frame logic

//Run frame one more time
glutTimerFunc( 1000 / SCREEN_FPS, runMainLoop, val );

int main( int argc, char* args[] )
//Initialize FreeGLUT
glutInit( &argc, args );

//Create Double Buffered Window
glutInitDisplayMode( GLUT_DOUBLE );
glutCreateWindow( "OpenGL" );

//Do post window/context creation initialization
if( !initGL() )
printf( "Unable to initialize graphics library!\n" );
return 1;

//Set rendering function
glutDisplayFunc( render );

//Set main loop
glutTimerFunc( 1000 / SCREEN_FPS, runMainLoop, 0 );

//Start GLUT main loop

return 0;

I'm sure the LazyFoo guys are great and all, and I'm not trying to discourage you, but I'd just start a new iOS project in Xcode as an OpenGL game and learn shaders (modern OpenGL) and everything from the start. Xcode has a lot of good information in the documentation. If you open a terminal on a mac, you can also do things like
man glEnable on command line to print the man(ual) pages for commands (like glEnable) if you like doing things old school.

07-24-2014, 12:55 AM
So, I don't have to include freeglut in code? And, should I be concerned about fixing the deprecated function warnings?

07-24-2014, 04:12 AM
Freeglut is just a "open source alternative to glut." In the code I posted, you can see glut.h is the first thing I include.

Deprecation is a really fancy way of saying "you're not supposed to use this anymore, come back one day and your favorite feature will probably be gone!"