0

我在我的应用程序中使用zxinglib OS X。我已经包含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++ 编译器选项)与演示项目属性进行了比较,一切正常。

4

1 回答 1

2

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

于 2013-04-07T15:31:04.117 回答