Ants, Bees, Genomes & Evolution @ Queen Mary University London
Compiling Linux Glut code on OS X - WITHOUT PROJECTBUILDER
This tip works on os 10.1.x, but on jaguar, you systematically get a bus error
The machines we use at school are linux machines and we do all our c+ projects using emacs and gcc. OSX being a unix this stuff should work, right?
It doesn't compile" Why? Because we use glut and our #include GL/glut.h calls don't work since GL is not defined on macos.
This is how I ended up getting my code to compile. I'm sure this can be done much more elegantly... if you have something in mind please send me an email
- change the Glut/gl includes to
#ifdef _MAC_OS_X
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#endif in your makefile, change your x11/glut linked libs from
LDLIBS = -lglut -lGL -lGL
toLDLIBS = -framework Foundation -framework OpenGL -framework GLUT
- that's it!type make and enjoy