Xcode: how to link dylib library files
2013-01-16 14:12
447 查看
When linking with external dylib for an Xcode project. You might get this error:
dyld: Library not loaded: libXXX.dylib
Referenced from: .../Developer/Xcode/DerivedData/quack-gpfxwhnflltwzkdnerqlydkddvbj/Build/Products/Debug/zzz
Reason: image not found
Xcode 4.0 solution
1) click on the project in the side pane to bring up the properties.
2) click on "Target"
Checking the library:
3) In "Build Settings"
4) Using search, enter "library". There should be a path automatically set in the field for "Library Search Paths" if you added the dylib to your project.
Add a copy files phase:
3) In "Build Phases"
4) Click "Add Build Phases"
5) Click "Add Copy Files"
6) In "Destination" select "Executables"
7) Add entry by clicking the "+"
8) Choose the .dylib file from your project or manually locate it.
这种做法实际上是将dylib放在生成的app文件目录下(程序首次运行时,会将工程中的dylib文件copy到app目录)。经过测试,完全没有必要将dylib文件导入工程,直接拖到最终app目录下就可。
dyld: Library not loaded: libXXX.dylib
Referenced from: .../Developer/Xcode/DerivedData/quack-gpfxwhnflltwzkdnerqlydkddvbj/Build/Products/Debug/zzz
Reason: image not found
Xcode 4.0 solution
1) click on the project in the side pane to bring up the properties.
2) click on "Target"
Checking the library:
3) In "Build Settings"
4) Using search, enter "library". There should be a path automatically set in the field for "Library Search Paths" if you added the dylib to your project.
Add a copy files phase:
3) In "Build Phases"
4) Click "Add Build Phases"
5) Click "Add Copy Files"
6) In "Destination" select "Executables"
7) Add entry by clicking the "+"
8) Choose the .dylib file from your project or manually locate it.
这种做法实际上是将dylib放在生成的app文件目录下(程序首次运行时,会将工程中的dylib文件copy到app目录)。经过测试,完全没有必要将dylib文件导入工程,直接拖到最终app目录下就可。
相关文章推荐
- How to add multiple static library files with different architectures to Xcode
- how to compile and link static/dynamic library in linux
- HowTo compile native C codes to a library for iOS development in Xcode – take Mosquitto as an exampl
- How to create a custom directory for app files inside the ~/Library/Application Support directory.
- How to Use the Dynamic Link Library in C++ Linux (C++调用Delphi写的.so文件)
- How to Upload multiple files to documentLibrary in one time
- How to link with the correct C Run-Time (CRT) library
- How to make Universal Static library (.a file) in iOs using xCode
- How to link with the correct C Run-Time (CRT) library
- failed to load the jni shared library "C:\Program Files\java\jdk1.7.0_15\bin..\jre\bin\server\jvm.d"
- how to use the curses library in unix?
- How to delete subfolders and files in a folder
- SharePoint 2013 Step by Step—— How to Upload Multiple Documents in Document Library
- How to Run Instruments in Xcode 4?
- How to read/write files within a Linux kernel module?
- How to get files to show up in the Process Monitor/Report Repository
- Netezza External Tables --How to use local files in external table
- [Android] How to import library into android studio
- How to create EPS files...
- How to add or replace files within MSI file.