ios xcode 5.1 - 架构 x86_64 (zbar) 的未定义符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22560899/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 23:47:03  来源:igfitidea点击:

xcode 5.1 - Undefined symbols for architecture x86_64 (zbar)

iosobjective-cxcodearchitecture

提问by Atanu Mondal

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.

我已经将我的 x 代码版本从 5.0 更新到 5.1
我在我的项目中使用了 ZBarSDK 来扫描条形码。在模拟器“iPhone Retina(3.5 英寸)”和“iPhone Retina(4 英寸)”中,它运行良好。但是,当我想使用模拟器“iPhone Retina(4 英寸 64 位)”进行构建时,出现以下错误。

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)

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

架构:标准架构(arm64, armv7, armv7s) - $(ARCHS_STANDARD)
有效架构:arm64,armv7,armv7s
基础SDK:最新IOS(IOS 7.1)
iOS 部署目标:iOS 6.1

Any help much appreciated!

非常感谢任何帮助!

回答by Kirit Vaghela

USING PODS

使用豆荚

pod 'ZBarSDK'

OR

或者

Recompile ZBar for iphone 5. You can download recompiled ZBAR from hereto skip the following

Recompile ZBar for iphone 5. 你可以从这里下载重新编译的ZBAR跳过下面的

Steps

脚步

  1. Download the source code (you must have Mercurialfor mac):

  2. Open Terminal and run following commands

    a. hg clone http://zbar.hg.sourceforge.net:8000/hgroot/zbar/zbar

    b. cd zbar

    c. hg checkout iPhoneSDK-1.3.1

    d. open iphone/zbar.xcodeproj

  3. In the xcode project edit the "libzbar" scheme and select Release in Build configuration

  4. Go to Build Settings set following Architectures

    a. Architectures- >Standard architectures(armv7,armv72,arm64)

    b. Valid Architectures-> arm64,armv7 armv7s

  5. Compile libzbar for deviceAND for simulator, here the configuration:

  6. Find the compiled libzbar.a and go in the folder using Teminal.app,

    In My Case : /Users/kappe/Library/Developer/Xcode/DerivedData/zbar-gyozyrpbqzvslmfoadhqkwskcesd/Build/Products

    In this folder you you should have two sub folder Release-iphoneos and Release-iphonesimulator

  7. using xcode command line tools build your universal lib:

    lipo -create Release-iphoneos/libzbar.a Release-iphonesimulator/libzbar.a -o libzbar.a

    Now you can use the libzbar.a created, both in device and simulator.

  1. 下载源代码(你必须有Mac 版Mercurial):

  2. 打开终端并运行以下命令

    一种。汞克隆http://zbar.hg.sourceforge.net:8000/hgroot/zbar/zbar

    湾 cd zbar

    C。汞结帐 iPhoneSDK-1.3.1

    d. 打开 iphone/zbar.xcodeproj

  3. 在 xcode 项目中编辑“libzbar”方案并在构建配置中选择发布

  4. 转到遵循架构设置的构建设置

    一种。架构- >标准架构(armv7,armv72,arm64)

    有效架构-> arm64,armv7 armv7s

  5. 设备模拟器编译 libzbar ,这里是配置:

  6. 找到编译好的 libzbar.a 并使用 Teminal.app 进入文件夹,

    在我的情况下:/Users/kappe/Library/Developer/Xcode/DerivedData/zbar-gyozyrpbqzvslmfoadhqkwskcesd/Build/Products

    在这个文件夹中你应该有两个子文件夹 Release-iphoneos 和 Release-iphonesimulator

  7. 使用 xcode 命令行工具构建您的通用库:

    lipo -create Release-iphoneos/libzbar.a Release-iphonesimulator/libzbar.a -o libzbar.a

    现在您可以在设备和模拟器中使用创建的 libzbar.a。

Ref : http://www.federicocappelli.net/2012/10/05/zbar-library-for-iphone-5-armv7s/

参考:http: //www.federicocappelli.net/2012/10/05/zbar-library-for-iphone-5-armv7s/

回答by Shubhank

This implies the library is not supported/built for the new archtitecture.

这意味着该库不支持/为新架构构建。

For zBar this answerhas link to tutorial where you can download the source and just update the lib to new architecture.

对于 zBar,此答案包含指向教程的链接,您可以在其中下载源代码并将库更新为新架构。

Generally for a third party service. they will release new lib with the architecture added so make sure to check out their site for updated SDK.

一般用于第三方服务。他们将发布添加了架构的新库,因此请务必查看他们的站点以获取更新的 SDK。

回答by Kaptain

Put in you Build Settings under "Other Librarian Flags" and "Other Linker Flags": $(OTHER_LDFLAGS)

在“其他图书馆员标志”和“其他链接器标志”下放入构建设置:$(OTHER_LDFLAGS)