简体   繁体   English

如何通过Xcode 6为iOS构建C库?

[英]How to build a C library for iOS by Xcode 6?

I trying to build C library for iOS like the following picture. 我试图为iOS构建C库,如下图所示。

在此处输入图片说明

I have build the liblib.a , but it compile error after I use liblib.a 我已经建立了liblib.a ,但是在我使用liblib.a之后它会编译错误。

The error log is like the following when I use liblib.a 当我使用liblib.a时,错误日志如下所示

file was built for archive which is not the architecture being linked (armv7): /Users/apk/Desktop/libTest/liblib.a
Undefined symbols for architecture armv7:

It seems the liblib.a not support for armv7 , but I didn't find the armv7 and the arm64 in Build Setting -> Architectures. 似乎liblib.a不支持armv7 ,但是在Build Setting-> Architectures中找不到armv7和arm64。

How do I build the library of C code for armv7 and use in Objective-C ? 如何为armv7构建C code库并在Objective-C

---------------------EDIT--------------------- - - - - - - - - - - -编辑 - - - - - - - - - - -

After I change the setting like the following picture. 更改设置后,如下图所示。

在此处输入图片说明

It has the .a file . 它具有.a file But when I try to use this library , it also show 但是当我尝试使用该库时,它也会显示

file was built for archive which is not the architecture being linked (armv7): /Users/apk/Desktop/libTest/liblib.a
Undefined symbols for architecture armv7: 

Did I missing something ? 我错过了什么吗?

---------------------EDIT2--------------------- --------------------- EDIT2 ---------------------

I build the .a by following step. 我按照以下步骤构建.a。

1.Create new project. 1.创建新项目。

在此处输入图片说明

2.Setting 2.设置

在此处输入图片说明

3. 3。 在此处输入图片说明

4. 4。 在此处输入图片说明

5.put the C file and the .h file into project. 5.将C文件.h文件放入项目中。

  1. Press the build button 按下构建按钮

Thanks in advance. 提前致谢。

在此处输入图片说明 You Want Creating library for ios see below picture for Architectures setting 您想要为iOS创建库,请参见下图的“架构”设置 在此处输入图片说明

Try this 尝试这个

下一个有用的图片

基本SDK设置为“最新OS X”,而不是“最新iOS”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM