iOS静态库Xcode(链接错误) [英] iOS Static Library Xcode (linking errors)

查看:91
本文介绍了iOS静态库Xcode(链接错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用编译选择设备的Xcode创建了静态库.

I created a static library with Xcode I have compiled selecting a device.

我将此添加到了Xcode 4.6的库测试项目中

I added this to my library test project in Xcode 4.6

但是在链接过程中我总是有2个错误...

but I always have 2 errors during the linking...

我遵循了本教程:静态库iOS教程

如果我下载示例代码,我将遇到相同的错误:

if I download the sample code I have the same errors:

ld:警告:忽略文件/Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/ICodeBlogsMathTest/Classes/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a,缺少必需的体系结构i386.片)体系结构i386的未定义符号:"_OBJC_CLASS _ $ _ MathFunctions",引用自:MathTestAppDelegate.o中的objc-class-refld:找不到体系结构i386的符号clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)

ld: warning: ignoring file /Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a, missing required architecture i386 in file /Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a (2 slices) Undefined symbols for architecture i386: "_OBJC_CLASS_$_MathFunctions", referenced from: objc-class-ref in MathTestAppDelegate.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

推荐答案

我遵循了此分步教程:

教程

尤其是我必须添加以下标志: -ObjC -all_load

in particular I had to add these flags: -ObjC and -all_load

这篇关于iOS静态库Xcode(链接错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆