Xcode - 如何包括c库和头文件到可可项目? [英] Xcode - how to include c library and header file to cocoa project?
问题描述
如何添加c库到Xcode Cocoa项目?
或者什么是最好的选择,我不想将它们复制到Cocoa项目目录。 / p>
我有一个名为 a
的C项目,它编译成库 a.dylib
和头文件 ah
,项目位于自己的目录中。
如何将头文件和库添加到我的Xcode项目?
我可以拖动 a.dylib
到其他框架
,但我能做什么 ah
我想出来了。
我指向项目设置中的搜索路径部署目录(标题)的项目位置 a
strong>:
- 为
标题搜索路径
,如果用作< a / a.h>
- 或
用户标题搜索路径
用作a / ah
到Xcode项目并将其设置为引用库而不是复制。
How do I add c library to Xcode Cocoa project?
Or what is the best option, I don't want to copy them into Cocoa project directory.
I have a C project called a
which compiles into library a.dylib
and header file a.h
, the project is located in it's own directory.
I want to use this library from my objective-c application in Xcode.
How do I add the header file and library to my Xcode project?
I can drag the a.dylib
into other frameworks
but what do I do with a.h
?
I figured it out.
I point to location of project a
deployment directory (headers) to Search Path in project settings either:
- as
Header Search Paths
, if used as<a/a.h>
- or into
User Header Search Paths
, if used as"a/a.h"
As for library I just drag it to Xcode project and set it to refer to library instead of copy.
这篇关于Xcode - 如何包括c库和头文件到可可项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!