Tag Archives: ld: library not found for -xxx

[Solved] LD: library not found for – XXX when Xcode compiles code

Sometimes under Xcode, we need to introduce a third-party class library or a static library written by ourselves. If the configuration is not correct, the following error will occur

ld: library not found for -XXXX

clang: error: linker command failed with exit code 1 (use -v to see invocation)。

Most of the time, there may be a problem with the connection reference of one of your libraries. The solution is to select. A or framework in link binary with libraries in the target of the project, cancel it and then add it

Modification method

1. Configuration under target

Target->”Build Phases”->”Link binary With Libraries” 
This is the name of the library to add. If it's an internal Xcode library, just look for it and add it. If you are looking for a third-party static or dynamic library, you will need to click "Add Other..." to install it.

2、Project

If you have found or written a third-party static or dynamic library, you also need to add the paths 
Project-> "Build Setting"-> "Search Paths"-> "Library search Paths" 
Add the path where the library is located

3. Configuration under other link flags (it may not be processed after deleting the third party framework)

Target->” Build Setting”->”Other Link Flags, Find the third party related to the error report, select it and then click on the minus sign to delete it