zxing在xcode 4.5和ios 6中 [英] zxing in xcode 4.5 and ios 6

查看:90
本文介绍了zxing在xcode 4.5和ios 6中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许多人注意到了; zxing不适用于最新的xcode(4.5 / ios 6)

As many of you noticed; zxing does not work in latest xcode (4.5/ios 6)

以下是用例:



  1. 从trunk查看最新版本(已添加一些修补程序)

  2. 使用ios 6.0在xcode 4.5中创建单一视图应用程序

  3. 使用README添加依赖项,路径等(只需按步骤操作)

  4. 将zxingcontroller调用添加到类(重命名为mm)

  1. checkout latest version from trunk (as some fixes were already added)
  2. create single view application in xcode 4.5 with ios 6.0
  3. use README to add dependencies, paths etc (just follow step by step)
  4. add zxingcontroller call to class (renamed to mm)


模拟器和设备的编译都失败
显示31错误,如下所示:

Compilation fails both for simulator and device It shows 31 error like this one:

Undefined symbols for architecture i386:
  "std::string::c_str() const", referenced from

所有31个错误都相似,区别在于符号名称

all 31 errors are similar, difference is in symbols name

可能是某人知道如何用这个用例来解决它?

May be somebody knows how to solve it with this use case?

ps如果你有以前的Xcode的应用程序,它的工作原理。只有在Xcode 4.5中创建新应用程序时才会出现问题

p.s. if you have app from previous Xcode, it works. Problem is only if you create new app in Xcode 4.5

推荐答案

您遇到的问题似乎与C ++标准库有关。

The issue you have encountered seems to be C++ standard library related.

实际上,每当您看到链接器与标准库对象的关系失败时(例如 std :: string ),应该检查所有链接库和app-project本身的项目设置。它们通常需要匹配!

Actually, whenever you see linker failures in relationship with standard library objects (e.g. std::string), you should check the project settings on all linked libraries and the app-project itself. They usually need to match!

原始ScanTest(将ZXingWidget构建为子项目)使用以下设置,如果您使用以下设置,则需要匹配您的App构建设置图书馆一样。

The original ScanTest (which builds ZXingWidget as a subproject) uses the following settings and those need to match your App build-settings if you use the library as is.

为了确保,我使用Xcode 4.5创建了一个全新的项目。该项目使用ZXingWidget作为预建库但不是作为子项目 - 我不喜欢子项目的东西不是我自己的 - 虽然这个专业不会影响结果。

For making sure, I created a brand-new project using Xcode 4.5. That project uses ZXingWidget as a prebuilt library but not as a subproject - I dont like subprojects for stuff that is not my own - though this specialty wont influence the results.

重要的设置是 C ++标准库 - 确保设置为 编译器默认

The important setting is C++ Standard Library - make sure that is set towards Compiler Default

一点澄清

实际上,您不需要使用 C ++标准库 ,您也可以使用 LLVM C ++标准库和C ++ 11支持 您必须在与项目链接的所有项目,子项目和库中使用完全相同的库。因此,如果您坚持使用该库的更新版本(C ++ 11支持),那么您还必须使用这些设置构建ZXing库。

Actually, you do not need to use C++ Standard Library, you may as well use LLVM C++ standard library with C++11 support. But you will have to use that exact same library in all projects, sub-projects and libraries that link with your project. So if you insist on using the more recent version of that library (C++11 support), then you will have to build the ZXing library with those settings as well.

最后但同样重要的是,确保您的 架构 有效架构 设置匹配所有项目和子项目(修复常见的 armv7s 链接器问题)。

Last but not least, make sure your Architectures and Valid Architecture settings are matching over all projects and sub projects (fixing the common armv7s linker issue).

首先,确保 架构 设置设置为 armv7 armv7s 。然后还将所有项目的项目设置编辑为 有效架构 armv7s armv7

First, make sure your Architectures setting is set towards armv7 armv7s within all projects. Then also edit the project settings of all projects towards Valid Architecture armv7s armv7.

这篇关于zxing在xcode 4.5和ios 6中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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