In the process of IOS development, this problem is easy to be confused. Let’s have a break today.
Problems and Solutions
In short, there are two aspects to this problem.
The error is as follows, which means that it is an exception when querying Library
.
"directory not found for option '-L/..."
resolvent:
Project – & gt; targets – & gt; build setting – & gt; library search paths
Delete the path inside
The error is as follows, which means that it is an exception when querying framework
.
"directory not found for option '-F/..."
resolvent:
Project – & gt; targets – & gt; build setting – & gt; framework search paths
Delete the path inside
OK, it’s done.
The above problems have been solved. If you want to know more, you can continue to look down.
explain
Briefly speaking, library search paths
and framework search paths
.
Framework Search Paths
The explanation that can be found in official documents is as follows:
Locating Frameworks in Non-Standard Directories
If your project links to frameworks that are not included in any of the standard locations, you must explicitly specify the location of that framework before Xcode can locate its header files. To specify the location of such a framework, add the directory containing the framework to the “Framework Search Paths” option of your Xcode project. Xcode passes this list of directories to the compiler and linker, which both use the list to search for the framework resources.
Note: The standard locations for frameworks are the
/System/Library/Frameworks directory
and the/Library/Frameworks directory on the local system.
If the frameworks you refer to are not in standard locations, you need to set “framework search paths” in the configuration file of the project to specify search paths for compilers and linkers.
Library Search Paths
As for “library search paths”, there is no decent official document, but the content should be similar, but one is used to search framework
, and the other is used to search Library
.
Although it is said that, what is library and what is framework are still very vague.
However, we found some blogs to illustrate this problem, which are quoted below.
quote
Search paths settings in IOS development
In the development of IOS, we often encounter some path settings, such as the introduction of Baidu map SDK, copying projects to other computers, or reporting the error of
library not found
when multiple people develop at the same time, or introducing a third-party library, such asasihttprequest / retableview
often reporting? Include & lt; & gt;
error, so we need to configure some search paths.Framework/Library Search Paths
1、Framework Search Paths
The search path of the framework (
. Framework bundles
) attached to the project is not widely used in IOS development. Generally, the framework built in the system is used for IOS development.2、Library Search Paths
Xcode will automatically set the search path of the. A file to be dragged to the third-party library (
. A files
) in the project. In order to facilitate transplantation or multi person collaborative development, it will usually be manually set.For example, we will set the SDK of Baidu map as follows:
$(SRCROOT)/../libs/Release$(EFFECTIVE_ PLATFORM_ Name)
, where$(srcroot)
macro represents your project file directory,$(effective)
_ PLATFORM_ Name) macro represents whether the current configuration is OS or simulatorHeader Search Path
1. C / C + + header file reference
In C / C + +, include is a mutation instruction. When compiling, the compiler will replace the relative path with the absolute path. Therefore, the absolute path of the header file is equal to the search path + relative path.
(1)
? Include & lt; iostream. H & gt;
: refers to the header file under the compiler’s class library path(2)
? Include "hello. H"
: the header file that refers to the relative path of the project directory2、(User) Header Search Path
(1)
header search path
refers to the search path of the header file.(2)
User header search paths
refers to the search path of user-defined header files3、Always Search User Paths
If
always search user paths
is set toYes
, the compiler will first search the path configured byUser header search paths
. In this case,? Include & lt; string. H & gt;
,User header search paths
the files under the search directory will cover the header files of the system.
reference material
- search paths settings in IOS development, IOS: clarify different search paths, IOS developer Library – including frameworks