问题
I am trying to compile an app that uses multiple libraries using Xcode. To do so, I created a script that copies all of my .dylibs
from a location on my computer to the Frameworks
folder inside my app bundle.
After adding the necessary linker flags
and header search paths
, I must now add my library search paths
.
Since I have copied all the libraries inside my Frameworks folder of my app bundle, I have deduced that I must add $(FRAMEWORKS_FOLDER_PATH)
to the library search paths
setting. Adding this fails, because the linker can not find that directory.
I am guessing that the Frameworks
folder isn't created until after searching the library search paths
setting. If so, how am I supposed to use the libraries that I have copied inside my app bundle?
回答1:
Placing the .dylib
files in the Frameworks
folder is something you do so that the application can find them when it runs.. dylib
files are dynamically linked, so the application loads them at run time.
Setting Xcode up to link to the .dylibs at compile time should just be a matter of dragging the .dylib
from the Finder into your Xcode project. I've shown this with a simple example project that uses libxar.dylib in the attached screenshot.
来源:https://stackoverflow.com/questions/20695805/using-dylibs-inside-app-bundle