I’ve been trying for a while to get GLEW (The OpenGL Extension Wrangler Library) working and finally I did it. I think this could be useful for other people. First let me define the platform this way:
- MacBook (2GHz Intel Core 2 Duo)
- Mac Os 10.5 (Leopard)
- Xcode version 3.0
- glew 1.4.0
Download the last source files of GLEW (at this moment 1.4.0), be sure to downolad the .tgz file. Don’t try either the compiled or the .zip version of the files, there are some issues with them and apparently the .tgz file is the only one that works (read the newsgroup of GLEW in sourceforge for more information about this).
1. Unziping and untaring the file:
tar zxvf glew-1.4.0-src.tgz
2. Compile the sources from a terminal window:
There are some harmless warnings that don’t affect the compilation. Watch for errors, however I didn’t have a single one.
3. Install the binaries (you need superuser permissions):
The files are copied to /usr/lib and /usr/include/GL.
3. Open Xcode
4. Create a new project (The C++ Tool template is perfect)
5. Right-click on the name of the project and choose Add > existing frameworks…
6. Add to your project GLUT.framework. Also, add the following files and select the option of ‘including the file if necessary’ in the popping-up dialog:
/usr/lib/libGLEW.a and /usr/include/GL/glew.h
7. Include the following lines in your code (e.g., main.cpp):
8. Go to Project > Edit Project settings. In the pop-up window:
a) Select in Configuration tab: All configurations
b) Select in Architectures tab: i386 (you might need to change this according to your machine).
c) In Valid Architectures, delete all the existing architectures and leave only i386.
d) In ‘Other Linker Flags’ add this line:
-framework OpenGL -framework GLUT
That’s all. After that you can close the panel, and build, or ‘build and go’ your project and it should work.
I found these links somewhat useful :