包括Zxing到Xcode 4.3 + Obj-C的未定义符号

时间:2012-07-18 15:50:54

标签: objective-c ios xcode4.3 zxing

在将ZXingWidget包含到我之前的iOS项目中时,我遇到了一些问题。

这是我之前使用XCode4.3 + ARC for iOS开始的项目。对于这个项目,我需要包括ZXing进行扫描。

我已经按照提供的自述文件进行了操作。

  1. 将zxing复制到项目根目录中,添加ZXingWidget.xcodeproj项目
  2. 在构建阶段添加链接libZXingWidget.a
  3. 将ZXingWidget添加到目标依赖项
  4. 标题搜索路径 - 递归$(SRCROOT)/ zxing-read-only / iphone / ZXingWidget / Classes
  5. 标题搜索路径 - 非递归$(SRCROOT)/ zxing-read-only / cpp / core / src
  6. 导入所有必需的iOS框架。
  7. 注意事项:

    • ZXing在iphone模拟器上编译并正常运行
    • 我收到大约66个关于未定义符号的错误。 (以下示例)
    • Zxing代码是从SVN获得的(我也尝试过zip下载,但是64个错误)

    但是我无法直接从我的代码中导入任何文件 (#import not working)。

    我也试过这个solution而没有运气。

    我遗失的任何其他可能性?

    感谢任何帮助!

    我现在收到一些错误输出。

    Undefined symbols for architecture i386:
    "std::ios_base::Init::Init()", referenced from:
      ___cxx_global_var_init in libZXingWidget.a(Binarizer.o)
      ___cxx_global_var_init in libZXingWidget.a(BinaryBitmap.o)
      ___cxx_global_var_init in libZXingWidget.a(Array.o)
      ___cxx_global_var_init in libZXingWidget.a(BitArray.o)
      ___cxx_global_var_init in libZXingWidget.a(BitMatrix.o)
      ___cxx_global_var_init in libZXingWidget.a(BitSource.o)
      ___cxx_global_var_init in libZXingWidget.a(Counted.o)
      ...
    "std::terminate()", referenced from:
      zxing::Binarizer::Binarizer(zxing::Ref<zxing::LuminanceSource>) in libZXingWidget.a(Binarizer.o)
      zxing::Binarizer::~Binarizer() in libZXingWidget.a(Binarizer.o)
      zxing::BinaryBitmap::BinaryBitmap(zxing::Ref<zxing::Binarizer>) in libZXingWidget.a(BinaryBitmap.o)
      zxing::BinaryBitmap::~BinaryBitmap() in libZXingWidget.a(BinaryBitmap.o)
      zxing::BinaryBitmap::getBlackRow(int, zxing::Ref<zxing::BitArray>) in libZXingWidget.a(BinaryBitmap.o)
      zxing::BinaryBitmap::getWidth() const in libZXingWidget.a(BinaryBitmap.o)
      zxing::BinaryBitmap::getHeight() const in libZXingWidget.a(BinaryBitmap.o)
      ...
    "operator delete(void*)", referenced from:
      zxing::Binarizer::~Binarizer() in libZXingWidget.a(Binarizer.o)
      zxing::Counted::~Counted() in libZXingWidget.a(Binarizer.o)
      zxing::BinaryBitmap::~BinaryBitmap() in libZXingWidget.a(BinaryBitmap.o)
      zxing::BinaryBitmap::crop(int, int, int, int) in libZXingWidget.a(BinaryBitmap.o)
      zxing::BinaryBitmap::rotateCounterClockwise() in libZXingWidget.a(BinaryBitmap.o)
      zxing::Counted::~Counted() in libZXingWidget.a(BinaryBitmap.o)
      zxing::BitArray::~BitArray() in libZXingWidget.a(BitArray.o)
      ...
    "___cxa_allocate_exception", referenced from:
      zxing::Counted::release() in libZXingWidget.a(Binarizer.o)
      zxing::Counted::release() in libZXingWidget.a(BinaryBitmap.o)
      zxing::BitArray::setRange(int, int) in libZXingWidget.a(BitArray.o)
      zxing::BitArray::isRange(unsigned long, unsigned long, bool) in libZXingWidget.a(BitArray.o)
      zxing::BitMatrix::setRegion(unsigned long, unsigned long, unsigned long, unsigned long) in libZXingWidget.a(BitMatrix.o)
      zxing::Counted::release() in libZXingWidget.a(BitMatrix.o)
      zxing::BitSource::readBits(int) in libZXingWidget.a(BitSource.o)
      ...
    

1 个答案:

答案 0 :(得分:3)

您需要将main.m重命名为main.mm。这将告诉Xcode链接必要的C ++库,这是缺少的。