Xcode project setup for GLFW library
I'm working on an assignment which is to simulate the beginning of the universe using C and OpenGL/GLFW.
I'm pretty new to C and also to Xcode, which is not helping at all. I've overcome my silly compilation problems and the code is finding GL/glfw.h ok. When I compile and run I receive a "Visualisation [name of the project] has exited with status 5".
I wasn't really sure what that meant but if I try and run the code from the command line I get the following error:
ADAM:Debug adam$ ./Visualisation dyld: Library not loaded: @executable_path/libglfw.dylib Referenced from: /Users/adam/Documents/Programming/C/Visualisation/build/Debug/./Visualisation Reason: image not found Trace/BPT trap
I added libglfw.dylib to the project the same way I added libglfw.a to see if that fixed it and no, it didn't.
I can't figure out where @executable_path is set or what it is set to but inside the build settings for the project in Library Search Paths is "$(SRCROOT)/../../../../glfw/lib/macosx" which is where this library resides.
I checked that the library was executable and it is, do I need to set that library path somewhere else?
I have the same problem, i'm using Xcode 4.3.2 on a Macbookpro with Osx Lion 10.7.4.
1 - Install the GLFW library, please visit http://www.glfw.org/. 3 - Be sure you have added in your link binary with libraries option under the build phases OpenGL and Cocoa framework. 2 - Import libglfw.a in your Xcode project, using the project navigator. 4 - Now in your project navigator, inside Products directory right click on your_app_name file and select show in finder, copy the libglfw.dylib inside it.
The first thing I would like to say is that you need to read the Xcode manual, this question is answered there (and you may have other questions which will also be answered there).
To find the manual, launch Xcode and select "Xcode Workspace Guide" from the "Help" menu.
To answer the question, the application is looking for the library in the same directory as the application's executable. If I understand what you're doing, you've made a command-line application, the directory that contains Visualisation should also contain libglfw.dylib. @executable_path is /path/to/Visualisation.
If this was a typical application with a GUI interface, the path would probably be /path/to/VisualisationApplication.app/Contents/MacOS/Visualisation.