xcode 5.1 - 架构 x86_64 (zbar) 的未定义符号 [英] xcode 5.1 - Undefined symbols for architecture x86_64 (zbar)
问题描述
我已将我的 x 代码版本从 5.0 更新到 5.1
我在我的项目中使用了 ZBarSDK 来扫描条码.在模拟器iPhone Retina(3.5 英寸)"和iPhone Retina(4 英寸)"中,它运行良好.但是,当我想使用模拟器iPhone Retina(4 英寸 64 位)"进行构建时,出现以下错误.
I have updated my x code version from 5.0 to 5.1
I have used ZBarSDK in my project for scan bar code. In simulator 'iPhone Retina (3.5-inch)' and 'iPhone Retina(4-inch)', it is working fine. But when i want to build with simulator 'iPhone Retina (4-inch 64-bit)', it is giving the following error.
ld: warning: ignoring file /Users/sayan/Desktop/ProjectAtanu/Omlis/Custom Classes/ZBarSDK/libzbar.a, missing required architecture x86_64 in file /Users/sayan/Desktop/ProjectAtanu/Omlis/Custom Classes/ZBarSDK/libzbar.a (3 slices)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_ZBarReaderViewController", referenced from:
objc-class-ref in HomeViewController.o
"_ZBarReaderControllerResults", referenced from:
-[HomeViewController imagePickerController:didFinishPickingMediaWithInfo:] in HomeViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
架构:标准架构(arm64, armv7, armv7s) - $(ARCHS_STANDARD)
有效架构:arm64、armv7、armv7s
基础SDK:最新IOS(IOS 7.1)
iOS 部署目标:iOS 6.1
Architecture: Standard architecture(arm64, armv7, armv7s) - $(ARCHS_STANDARD)
Valid Architectures: arm64,armv7,armv7s
Base SDK: Latest IOS(IOS 7.1)
iOS Deployment Target: iOS 6.1
非常感谢任何帮助!
推荐答案
使用 PODS
pod 'ZBarSDK'
或
为 iphone 5 重新编译 ZBAR.您可以从 下载重新编译的 ZBAR此处跳过以下内容
Recompile ZBar for iphone 5. You can download recompiled ZBAR from here to skip the following
步骤
下载源代码(你必须有 Mercurial for mac):
打开终端并运行以下命令
Open Terminal and run following commands
一个.hg 克隆 http://zbar.hg.sourceforge.net:8000/hgroot/zbar/zbar
B.cd zbar
b. cd zbar
c.汞结帐 iPhoneSDK-1.3.1
c. hg checkout iPhoneSDK-1.3.1
d.打开 iphone/zbar.xcodeproj
d. open iphone/zbar.xcodeproj
在 xcode 项目中编辑libzbar"方案并在构建配置中选择发布
In the xcode project edit the "libzbar" scheme and select Release in Build configuration
转到遵循架构设置的构建设置
Go to Build Settings set following Architectures
一个.架构 - >标准架构(armv7,armv72,arm64)
a. Architectures - >Standard architectures(armv7,armv72,arm64)
B.有效架构 -> arm64,armv7 armv7s
b. Valid Architectures -> arm64,armv7 armv7s
为设备和模拟器编译libzbar,这里是配置:
Compile libzbar for device AND for simulator, here the configuration:
找到编译好的libzbar.a并使用Teminal.app进入文件夹,
Find the compiled libzbar.a and go in the folder using Teminal.app,
在我的例子中:/Users/kappe/Library/Developer/Xcode/DerivedData/zbar-gyozyrpbqzvslmfoadhqkwskcesd/Build/Products
In My Case : /Users/kappe/Library/Developer/Xcode/DerivedData/zbar-gyozyrpbqzvslmfoadhqkwskcesd/Build/Products
在这个文件夹中你应该有两个子文件夹 Release-iphoneos 和 Release-iphonesimulator
In this folder you you should have two sub folder Release-iphoneos and Release-iphonesimulator
使用 xcode 命令行工具构建您的通用库:
using xcode command line tools build your universal lib:
lipo -create Release-iphoneos/libzbar.a Release-iphonesimulator/libzbar.a -o libzbar.a
lipo -create Release-iphoneos/libzbar.a Release-iphonesimulator/libzbar.a -o libzbar.a
现在您可以在设备和模拟器中使用创建的 libzbar.a.
Now you can use the libzbar.a created, both in device and simulator.
参考:http://www.federicocappelli.net/2012/10/05/zbar-library-for-iphone-5-armv7s/
这篇关于xcode 5.1 - 架构 x86_64 (zbar) 的未定义符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!