Zxing 'undefined symbols for architecture x86-x64'错误



我在OS X应用程序中使用zxing lib。我已经将zxing-objc包含到我的项目中,并简单地将代码从zxing demo (zxing-root/objc/examples/demo)复制粘贴到单独的ViewController类中。当尝试编译项目时,我得到以下链接器错误:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_QTCaptureDevice", referenced from:
     objc-class-ref in ScanViewController.o
  "_OBJC_CLASS_$_ZXCapture", referenced from:
      objc-class-ref in ScanViewController.o
  "_QTMediaTypeMuxed", referenced from:
      -[ScanViewController performVideoSourceScan] in ScanViewController.o
  "_QTMediaTypeVideo", referenced from:
      -[ScanViewController performVideoSourceScan] in ScanViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我仔细检查了所有的代码,并将我的项目属性(包括c++编译器选项)与演示项目属性进行了比较,一切都是正确的。

你需要在你的应用目标中添加必要的框架。您可以在示例应用程序中查看示例。在Xcode中选择目标,选择Build Phases,然后打开Link With Libraries条目。您将看到它同时包含了QuartzCore和zxing-objc-framework。听起来你的项目中没有这些

最新更新