ios - 如何通过 Xcode 6 构建 iOS 的 C 库?

标签 ios c xcode static-libraries

我尝试为 iOS 构建 C 库,如下图所示。

enter image description here

我已经构建了 liblib.a ,但是在使用 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:

似乎liblib.a不支持armv7,但是我在Build Setting -> Architectures中没有找到armv7和arm64。

如何为 armv7 构建 C 代码 库并在 Objective-C 中使用?

--------------------编辑---------------------

更改设置后,如下图所示。

enter image description here

它有.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: 

我错过了什么吗?

--------------------编辑2------------------------

我按照以下步骤构建.a。

1.创建新项目。

enter image description here

2.设置

enter image description here

3. enter image description here

4. enter image description here

5.将C文件.h文件放入工程中。

  • 按下构建按钮
  • 提前致谢。

    最佳答案

    enter image description here您想要为 ios 创建库,请参阅下图了解架构设置 enter image description here

    试试这个

    Next helpful image

    关于ios - 如何通过 Xcode 6 构建 iOS 的 C 库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26778087/

    相关文章:

    c++ - 不同的 clang 和 gcc 行为与指针

    ios - uiscrollview 和 cocos2d 粘贴

    Xcode - 如何将构建上传到特定团队

    iphone - NavigationController 未加载 View

    ios - 从 UIViewController 启动 UICollectionView

    iphone - presentViewController 不支持 iOS 6 中的方向

    ios - 如何为 uitableviewcell 使用动态高度

    ios - faSTLane gym 你能跳过存档和导出步骤吗

    c++ - mariadb make_query 卡在 make_query() 调用中

    c++ - 带有 gtest(C++) 的 CMakeLists C 程序