xcode 忽略文件 [路径] 文件中缺少所需的架构 i386
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15659631/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ignoring file [path] missing required architecture i386 in file
提问by U_D
I'm quite new to Xcode and Iphone development and ran into the following problem:
我对 Xcode 和 Iphone 开发很陌生,遇到了以下问题:
I opened a new project and added *.h and a *.a files (which I recived from a certain device vendor). I get the following warning:
我打开了一个新项目并添加了 *.h 和 *.a 文件(我从某个设备供应商那里收到了这些文件)。我收到以下警告:
ld: warning: ignoring file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a, missing required architecture i386 in file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a (2 slices)
ld:警告:忽略文件 /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a,在文件 /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a(2 个切片)中缺少所需的架构 i386 )
If I ignore the warning, and try to instanciate the class that is given to me in the header file, I get these errors:
如果我忽略警告,并尝试实例化头文件中提供给我的类,我会收到以下错误:
ld: warning: ignoring file [Path/FileName.a], missing required architecture i386 in file [Path/FileName.a] (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_HRMonitor", 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)
ld:警告:忽略文件 [路径/文件名.a],文件 [路径/文件名.a] 中缺少所需的架构 i386(2 个切片)
架构 i386 的未定义符号:
“_OBJC_CLASS_$_HRMonitor”,引用自:
ViewController.o 中的 objc-class-ref
ld:找不到架构 i386 的符号
clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
I've checked the Framework Search Pathes (as mantioned in many other posts) and it clear.
我检查了框架搜索路径(如许多其他帖子中所述)并且很清楚。
More info:
更多信息:
- I'm Using Xcode 4.6.1
- The files are currently located at project's root folder.
- I'm using a Single View Application tamplate.
- 我正在使用 Xcode 4.6.1
- 这些文件当前位于项目的根文件夹中。
- 我正在使用单一视图应用程序模板。
Appreciate any help
感谢任何帮助
回答by Dmitry Zhukov
This warning means that you're trying to use library made for Device (ARM) with your Simulator (i386).
此警告意味着您正在尝试将为设备 (ARM) 制作的库与模拟器 (i386) 一起使用。
You can use this terminal command to create a universal library:
您可以使用此终端命令来创建通用库:
lipo -create lib_arm.a lib_i386.a -output lib_universal.a
More info about lipocommand here.
关于lipo命令的更多信息在这里。
回答by Lucas Goossen
Change your target's "Build Settings > Build Active Architectures Only" to "No"
将目标的“Build Settings > Build Active Architectures Only”更改为“No”
This is doing the same thing as Dmitry Zhukov's answer but doing it thru Xcode instead of going around its back.
这与 Dmitry Zhukov 的回答做同样的事情,但通过 Xcode 而不是绕过它的背后。
回答by Yunus Nedim Mehel
If you are working with a 3rd party code, keep in mind that some SDKs may not work on the simulator. The same build error I have encountered vanished, when I ran the project on the device.
如果您使用的是 3rd 方代码,请记住,某些 SDK 可能无法在模拟器上运行。当我在设备上运行项目时,我遇到的相同构建错误消失了。