文件是为存档而构建的,而不是链接的体系结构(i386) [英] file was built for archive which is not the architecture being linked (i386)

查看:102
本文介绍了文件是为存档而构建的,而不是链接的体系结构(i386)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要构建静态库。我想在我的iPhone和ipad应用程序中使用。当我尝试运行模拟器时,我得到链接错误。我是iOS开发的新手。亲切的帮助;

I got to build static library. I want to use in my iPhone and ipad app. When I try to run the simulator I get linking errrors. I am new to iOS development. kindly help;


ld:警告:忽略文件
/Users/valuelabs/Desktop/DruvaProject/libraries/libnetUtils.a,文件
是为存档而构建的,而不是被链接的体系结构
(i386)体系结构i386的未定义符号:

_OBJC_CLASS _ $ _ netUtils,引自:
objc ViewController.o中的-class-ref ld:找不到架构i386 clang的符号:错误:链接器命令失败,退出代码为1
(使用-v查看调用)

ld: warning: ignoring file /Users/valuelabs/Desktop/DruvaProject/libraries/libnetUtils.a, file was built for archive which is not the architecture being linked (i386) Undefined symbols for architecture i386:
"_OBJC_CLASS_$_netUtils", referenced from: objc-class-ref in ViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

我尝试在架构中添加i386。但没有运气

I tried adding i386 in the Architectures. but no luck

推荐答案

在努力解决同样的问题并遵循更新构建设置的所有已接受答案后,清除链接器搜索路径等等。我终于找到了一个对我有用的答案。

After struggling with this same problem and following all the accepted answers of updating build settings, clearing the linker search path, etc.. I finally discovered an answer that worked for me.

在构建之前,请确保选择正确的类型(iPhone模拟器)而不是iOS设备。然后重建。否则,您正试图在Mac(i386)上的模拟器上使用为iOS设备(arm处理器)构建的库。应该是显而易见的,但事实并非如此。

Before building, make sure you select right type (iPhone Simulator) instead of iOS Device. Then rebuild. Otherwise, you're trying to use a library built for an iOS device (arm processor) on a simulator on your mac (i386). Should've been obvious, but wasn't.

之前:

之后:

现在,查看导航器中的Products组>右键单击静态库(.a文件)>在Finder中显示,你会发现它在Debug-iphonesimulator中文件夹而不是Debug-iphoneos。我最初没有注意文件夹名称,或者我可能早就想到了这一点。

Now, look in the Products group in the Navigator > right click your static library (.a file) > Show in Finder, you'll notice that its in a Debug-iphonesimulator folder instead of Debug-iphoneos. I didn't pay any attention to the folder name originally, or I might have thought of this sooner.

希望这会有所帮助。

这篇关于文件是为存档而构建的,而不是链接的体系结构(i386)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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