View Full Version : Xcode 4 Dynamic Linking - Not working AT ALL

Aug 7, 2012, 04:49 PM
I've been trying to solve this for a while, but I can't come up with a solution. I have a Xcode project that uses the box2d c++ library. I'm trying to link against the .dylib file, but nothing seems to work!

Created a new SFML application (I used project templates provided by SFML, so the project is set up correctly for that library)
Went to the "Targets", selected my application, and added my .dylib file in the "Link Binary With Libraries" section
Created a new "Copy Files" build phase, set it to "Frameworks", and added the .dylib file
Set the "Dynamic Library Install Name" option in the "Build Settings" tab to "@loader_path/../Frameworks/libBox2D.2.1.0.dylib"
Successfully compiled my project with no errors whatsoever
Ran the project and got the following runtime-error:

dyld: Library not loaded: libBox2D.2.1.0.dylib
Referenced from: /Users/****/Documents/Xcode Projects/ProjectName/DerivedData/ProjectName/Build/Products/Debug/ProjectName.app/Contents/MacOS/ProjectName
Reason: image not found

What did I do wrong? This seems to be what everyone does to link their .dylib files to their projects. Am I missing something big? Or is the specific .dylib file simply un-linkable?