[英]Linking C libraries in Xcode iOS
I built C code separately and have libperson.a output. 我分别构建了C代码,并具有libperson.a输出。 I want to include this library into my xcode project.
我想将此库包含到我的xcode项目中。 Added this .a under “Link Binary with Libraries” to my project.
在“将二进制文件与库链接”下添加了该.a到我的项目中。
#import "person.h"
It can't find the person.h. 它找不到该人。h。 What am I doing wrong?
我究竟做错了什么?
You also need to add the header file(s) to you project. 您还需要将头文件添加到您的项目中。 Or, if the headers are better off somewhere else, you need to add a Header Search Path to your Xcode target's Build Settings;
或者,如果标题在其他地方更好,则需要在Xcode目标的Build Settings中添加Header Search Path; in that way Xcode can find them.
这样Xcode可以找到它们。
Coming from Java: C has header files in which you typically declare public interfaces of a matching source file. 来自Java:C具有头文件,您通常在其中声明匹配的源文件的公共接口。 Where in Java you have
import
after which the compiler sorts it all out for you from the binaries , in C you need to #include
the public definitions as header at the source file level . 在Java中已
import
,然后编译器从二进制文件中将其全部整理出来,在C中,您需要#include
公共定义作为源文件级别的头。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.