file not found with <angled> include; use "quotes" instead 这个错误提示不能使用<>大括号来引用静态库而要使用“”来引用静态库
下面讲解下如何 在工程中使用 <>来引用静态库。 在自己添加的.a 静态库中 如何 使用<>来引用头文件
1.先建立一个APPDemo工程
2.建立一个静态库工程 在新建静态库工程时将 这个静态库工程 添加到APPDemo工程中,这个很简单。
3.这样的静态库能直接用的只不过 引用时 使用的是#import "" 来 引用 静态库的头文件,就能顺利编译了。 但是 我看着 很难受 既然是静态库 就要搞得 牛逼点。最好能用#import<>来引用静态库的头文件 这样才像静态库的样子。
使用步骤如下:在 自己的静态库里面的 -> Build Settings -> Packaging 选项下(不好找的话在 Search Paths 选项上边) 找到 Public Headers Folder Path 默认 为 /usr/local/include 将这个选择 改为 自己 想要的路径 如 include/wifilib 改好后再 Build Phases -> Copy Files 找到 Subpath 选项 将 内容 改为 刚才 修改的名字 如 改为 include/wifilib
4.这样的话 在 APPDemo工程 里面 应用 静态库 的头文件时 就可以 #import<wifilib/wififind.h>了。
5.添加依赖简单,进入target“MyLib"的“Build Phases”,展开“Target Dependencies”,添加“静态库”。这样就添加了wifilib的依赖,在编译APPDemo时,编译器就会去编译wifilib 了。
下面 详细 讲讲 xcode 的工程 依赖
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
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.