问题描述
我已经构建了自己的静态C ++库,它使用以下设置构建:
I have built my own Static C++ Library, which is built with the settings:
- 架构:armv7,armv7s
- 仅构建活动架构:否
- 支持平台:iOS
- 有效架构:armv7,armv7s
- Architectures: armv7, armv7s
- Build Active Architectures Only: No
- Support Platforms: iOS
- Valid Architectures: armv7, armv7s
库项目构建良好,我得到.a文件(我已经清理了构建文件夹并再次构建项目以确保我的设置有效) 。
The library project builds well and I got the .a file (I have cleaned the build folder and built the project again to be sure my settings were effective).
我已将库(.a文件)添加到我的iOS项目中,但即使我在iOS上设置了完全相同的设置,项目也无法构建项目:
I have added the library (.a file) to my iOS project, but the project won't build even though I have set the exact same settings on the iOS project:
- 架构:armv7s,armv7
- 仅构建活动架构:是
- 支持平台:iOS
- 有效架构:armv7,armv7s
- Architectures: armv7s, armv7
- Build Active Architectures Only: Yes
- Support Platforms: iOS
- Valid Architectures: armv7, armv7s
我一直收到这个错误:
我缺少什么?它告诉我.a文件不是为armv7s构建的,但这正是我用它构建库的设置。
What am I missing? It tells me the .a file was not built for armv7s, but that is exactly the settings I built the library with.
推荐答案
当你构建一个库时,你必须为模拟器和设备编译它,然后将两个输出(.a文件)合并到1个库中,然后将它链接到你的iOS项目。
When you're building a library you must compile it both for the simulator and the device and then merge the two outputs (.a files) into 1 library and then link it to your iOS project.
这篇关于错误:“文件是为存档而构建的,而不是被链接的架构(armv7s)”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!