iphone – 使用从属子项目时在Xcode中链接问题

iphone – 使用从属子项目时在Xcode中链接问题,第1张

概述我正在使用 Xcode编写一个iPhone项目,并使用外部库.我将Xcode项目文件添加到父目标并调整标头搜索路径并将其设置为父目标构建目标中的直接依赖项. 现在奇怪的事情发生了:我可以打开库并编译它没有问题.该库链接到一些框架,例如AVFoundation.framework. 我清理目标并开始构建父项目.在我的构建结果中,我看到它构建了库,但随后链接失败并显示以下错误消息: Undefined 我正在使用 Xcode编写一个iPhone项目,并使用外部库.我将Xcode项目文件添加到父目标并调整标头搜索路径并将其设置为父目标构建目标中的直接依赖项.

现在奇怪的事情发生了:我可以打开库并编译它没有问题.该库链接到一些框架,例如AVFoundation.framework.

我清理目标并开始构建父项目.在我的构建结果中,我看到它构建了库,但随后链接失败并显示以下错误消息:

Undefined symbols:  "_AVCaptureSessionPresetMedium",referenced from:      _AVCaptureSessionPresetMedium$non_lazy_ptr in libZXingWidget.a(ZXingWidgetController.o)     (maybe you meant: _AVCaptureSessionPresetMedium$non_lazy_ptr)  "_CVPixelBufferGetHeight",referenced from:      -[ZXingWidgetController captureOutput:dIDOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)  "_CVPixelBufferLockBaseAddress",referenced from:      -[ZXingWidgetController captureOutput:dIDOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)  "_AudioServicesPlaySystemSound",referenced from:      -[ZXingWidgetController presentResultForString:] in libZXingWidget.a(ZXingWidgetController.o)  "_AudioServicesCreateSystemSoundID",referenced from:      -[ZXingWidgetController vIEwWillAppear:] in libZXingWidget.a(ZXingWidgetController.o)  "_CVPixelBufferUnlockBaseAddress",referenced from:      -[ZXingWidgetController captureOutput:dIDOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)  "_CVPixelBufferGetBaseAddress",referenced from:      -[ZXingWidgetController captureOutput:dIDOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)  "_CVPixelBufferGetBytesPerRow",referenced from:      -[ZXingWidgetController captureOutput:dIDOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)  "_iconv_close",referenced from:      zxing::qrcode::DecodedBitStreamParser::append(std::basic_string<char,std::char_traits<char>,std::allocator<char> >&,unsigned char const*,unsigned long,char const*)in libZXingWidget.a(DecodedBitStreamParser-64E27B33E79CBC52.o)      zxing::qrcode::DecodedBitStreamParser::append(std::basic_string<char,char const*)in libZXingWidget.a(DecodedBitStreamParser-64E27B33E79CBC52.o)  "_OBJC_CLASS_$_AVCaptureVIDeoPrevIEwLayer",referenced from:      objc-class-ref-to-AVCaptureVIDeoPrevIEwLayer in libZXingWidget.a(ZXingWidgetController.o)  "_iconv",char const*)in libZXingWidget.a(DecodedBitStreamParser-64E27B33E79CBC52.o)  "_OBJC_CLASS_$_AVCaptureSession",referenced from:      objc-class-ref-to-AVCaptureSession in libZXingWidget.a(ZXingWidgetController.o)  "_OBJC_CLASS_$_AVCaptureDevice",referenced from:      objc-class-ref-to-AVCaptureDevice in libZXingWidget.a(ZXingWidgetController.o)  "_kCVPixelBufferPixelFormatTypeKey",referenced from:      _kCVPixelBufferPixelFormatTypeKey$non_lazy_ptr in libZXingWidget.a(ZXingWidgetController.o)     (maybe you meant: _kCVPixelBufferPixelFormatTypeKey$non_lazy_ptr)  "_OBJC_CLASS_$_AVCaptureVIDeoDataOutput",referenced from:      objc-class-ref-to-AVCaptureVIDeoDataOutput in libZXingWidget.a(ZXingWidgetController.o)  "_CVPixelBufferGetWIDth",referenced from:      -[ZXingWidgetController captureOutput:dIDOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)  "_AudioServicesdisposeSystemSoundID",referenced from:      -[ZXingWidgetController dealloc] in libZXingWidget.a(ZXingWidgetController.o)  "_OBJC_CLASS_$_AVCaptureDeviceinput",referenced from:      objc-class-ref-to-AVCaptureDeviceinput in libZXingWidget.a(ZXingWidgetController.o)  "_AVLayerVIDeoGravityResizeAspectFill",referenced from:      _AVLayerVIDeoGravityResizeAspectFill$non_lazy_ptr in libZXingWidget.a(ZXingWidgetController.o)     (maybe you meant: _AVLayerVIDeoGravityResizeAspectFill$non_lazy_ptr)  "_CMSampleBufferGetimageBuffer",referenced from:      -[ZXingWidgetController captureOutput:dIDOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)  "_iconv_open",char const*)in libZXingWidget.a(DecodedBitStreamParser-64E27B33E79CBC52.o)  "_AVMediaTypeVIDeo",referenced from:      _AVMediaTypeVIDeo$non_lazy_ptr in libZXingWidget.a(ZXingWidgetController.o)     (maybe you meant: _AVMediaTypeVIDeo$non_lazy_ptr)ld: symbol(s) not foundcollect2: ld returned 1 exit status

我可以在父项目中包含所需的框架,但我认为通过在库项目中包含框架,链接就可以了.

我的问题是:我是否必须包含我的从属子项目在父项目中使用的所有框架,以确保正确链接,或者我做错了什么?

谢谢你的帮助.

解决方法 如果子项目编译成静态库,是的. 总结

以上是内存溢出为你收集整理的iphone – 使用从属子项目时在Xcode中链接问题全部内容,希望文章能够帮你解决iphone – 使用从属子项目时在Xcode中链接问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1033898.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存