# Xcode如何使用来引用静态库

file not found with <angled> include; use "quotes" instead 这个错误提示不能使用<>大括号来引用静态库而要使用“”来引用静态库

1.先建立一个APPDemo工程

2.建立一个静态库工程 在新建静态库工程时将 这个静态库工程 添加到APPDemo工程中，这个很简单。

3.这样的静态库能直接用的只不过 引用时 使用的是#import "" 来 引用 静态库的头文件，就能顺利编译了。 但是 我看着 很难受 既然是静态库 就要搞得 牛逼点。最好能用#import<>来引用静态库的头文件 这样才像静态库的样子。

4.这样的话 在 APPDemo工程 里面 应用 静态库 的头文件时  就可以 #import<wifilib/wififind.h>了。

5.添加依赖简单，进入target“MyLib"的“Build Phases”,展开“Target Dependencies”,添加“静态库”。这样就添加了wifilib的依赖，在编译APPDemo时，编译器就会去编译wifilib 了。

https://developer.apple.com/library/ios/featuredarticles/XcodeConcepts/Concept-Targets.html

http://developer.apple.com/library/mac/#featuredarticles/XcodeConcepts/Concept-Targets.html#//apple_ref/doc/uid/TP40009328-CH4-SW1

Xcode Target

A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. A target defines a single product; it organizes the inputs into the build system—the source files and instructions for processing those source files—required to build that product. Projects can contain one or more targets, each of which produces one product.

The instructions for building a product take the form of build settings and build phases, which you can examine and edit in the Xcode project editor. A target inherits the project build settings, but you can override any of the project settings by specifying different settings at the target level. There can be only one active target at a time; the Xcode scheme specifies the active target.

A target and the product it creates can be related to another target. If a target requires the output of another target in order to build, the first target is said to depend upon the second. If both targets are in the same workspace, Xcode can discover the dependency, in which case it builds the products in the required order. Such a relationship is referred to as an implicit dependency. You can also specify explicit target dependencies in your build settings, and you can specify that two targets that Xcode might expect to have an implicit dependency are actually not dependent. For example, you might build both a library and an application that links against that library in the same workspace. Xcode can discover this relationship and automatically build the library first. However, if you actually want to link against a version of the library other than the one built in the workspace, you can create an explicit dependency in your build settings, which overrides this implicit dependency.

Xcode Target
Target指定一个编译的产品
Target中包含一些指令，这些指令是关于如何调用在一个工程或者工作区的文件集合来编译这个产品的。一个Target定一个单独的产品;它管理组织在这个编译系统中，需要用来编译这个产品的输入(输入既是源文件和处理这些源文件的指令)。

(ps:也就是你通过修改这两个内容来达到编辑工程指令的目的，你就是用这种方式来修改和输入编译指令的)
Target 沿袭工程编译设置内容，但是你可以在Targe层通过指定不同的属性设置来重写任何工程设置。同一时间只能存在一个活动的Target;
Xcode Scheme 指定活动的Target。

Target 以及它所制定的产品可以与另一个Target相关联，如果一个Target需要依赖另一个Target的输出才能编译的话，前者既是依赖于后者的。如果两个Target都是在同一个工作区，Xcode可以发现这个依赖关系，进而以一个正确的顺序编译它们。这种关系被定义为：隐含依赖。你也可以在你的编译设置(build settings)中指定明显的Target依赖，你可以指定在Xcode可能会期望两个target中存在隐含依赖的关系为非依赖关系。例如，你可能编译一个库文件和一个程序文件，程序文件内部链接了这个库文件，那么Xcode会发现这个这个关系并且自动先编译库文件。然而，如果你事实上想要链接的不是此版本的库文件 ，也就是不想链接这个库文件新编译出来的，你可以在你的编译设置(build settings)里创建一个明显的依赖关系，来覆盖这个隐含依赖。

# Xcode Target

A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. A target defines a single product; it organizes the inputs into the build system—the source files and instructions for processing those source files—required to build that product. Projects can contain one or more targets, each of which produces one product.

The instructions for building a product take the form of build settings and build phases, which you can examine and edit in the Xcode project editor. A target inherits the project build settings, but you can override any of the project settings by specifying different settings at the target level. There can be only one active target at a time; the Xcode scheme specifies the active target.

A target and the product it creates can be related to another target. If a target requires the output of another target in order to build, the first target is said to depend upon the second. If both targets are in the same workspace, Xcode can discover the dependency, in which case it builds the products in the required order. Such a relationship is referred to as an implicit dependency. You can also specify explicit target dependencies in your build settings, and you can specify that two targets that Xcode might expect to have an implicit dependency are actually not dependent. For example, you might build both a library and an application that links against that library in the same workspace. Xcode can discover this relationship and automatically build the library first. However, if you actually want to link against a version of the library other than the one built in the workspace, you can create an explicit dependency in your build settings, which overrides this implicit dependency.

### Related Articles

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客