0

我们已经实现了一个静态库并尝试在项目中使用它。该库已编译/构建良好,但是当我们分别导入 .a 和 .h 文件后尝试运行项目时,遇到以下错误:

ld: warning: ignoring file Lib.a, file was built for archive which is not the architecture being linked (i386)

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_MFourInOneStaticLib", referenced from:
      objc-class-ref in MAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已经检查了架构。此外,我们正在使用模拟器进行测试。

4

1 回答 1

2

看起来你的库不包含正确的架构。

对于 ios,您需要 armv7,对于模拟器,您需要 i386

测试它

lipo -info %NAME%

通常 lipo 仅适用于 arm 或 x86

为两个拱门构建它,然后合并两个文件

lipo ./build/Release-iphoneos/%NAME% ./build/Release-iphonesimulator/%NAME% -output ./Dist/lib/%NAME% -create
于 2012-11-20T11:00:15.413 回答