Search code examples
static-librariesosx-mountain-lionxcode4.6glfw

linking glfw static library with Xcode 4


Okay I've been searching for hours to try and solve this but nothing has worked. This problem is very similar to other posts, but I none of their solutions work.

So I am writing an OpenGL program using glew and glfw and for some reason I am unable to get the program to compile. The error is on the include statement:

#include <GL/glfw.h>

and the error says 'GL.glfw.h' file not found.

I have followed all the instructions on the GLFW-2.7.8 Release Notes web page, which includes making glfw, and then importing the static library libglfw.a into Xcode. The library does show up under Build Phases -> Link Binary with Libraries, but apart from that Xcode doesn't seem to recognize it. For example, under the File Inspector it detects the file type as "Default - data".

The static library is configured for 64-bit architecture, which I am running.

I have tried changing the search paths under Build Settings.

I have the following frameworks included: Cocoa, OpenGL, and IOKit.

Please let me know if there is any more information you need to help me solve this problem and thank you for reading.


Solution

  • It turns out my glew was not importing correctly and so glfw did not work either. These are the steps I took:

    • Changed the Base SDK from Latest OSX (10.8) to Current OSX.

    After doing this, I "reduced" the error to an Apple Mach-O Linker (Id) error. Next:

    • Added -lGLEW to Other Linker Flags.

    • Added /opt/local/include/ to the header search paths

    • Added /opt/local/lib/ to the library search paths

    Here is where I found my answer.