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

查看:22
本文介绍了文件是为归档而构建的,这不是正在链接的体系结构(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",引用自:ViewController.o ld 中的 objc-class-ref:找不到架构 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.

之前:

之后:

现在,查看导航器中的产品组> 右键单击​​您的静态库(.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天全站免登陆