Xcode binding issue when using dependent subproject

I use Xcode to write an iPhone project, and I use an external library. I added the Xcode project file to the parent and adjusted the header search path and set it as a direct dependency in the target parent assembly.

Now a strange thing happens: I can open the library and compile it without any problems. The library is linked to some structures, for example. AVFoundation.framework .

I clear the goal and start building the parent project. In my build results, I see that it creates a library, but after that the connection is not made with these error messages:

 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, std::char_traits<char>, std::allocator<char> >&, unsigned char const*, unsigned long, char const*)in libZXingWidget.a(DecodedBitStreamParser-64E27B33E79CBC52.o) "_OBJC_CLASS_$_AVCaptureVideoPreviewLayer", referenced from: objc-class-ref-to-AVCaptureVideoPreviewLayer in libZXingWidget.a(ZXingWidgetController.o) "_iconv", 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) "_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", 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) "_AVMediaTypeVideo", referenced from: _AVMediaTypeVideo$non_lazy_ptr in libZXingWidget.a(ZXingWidgetController.o) (maybe you meant: _AVMediaTypeVideo$non_lazy_ptr) ld: symbol(s) not found collect2: ld returned 1 exit status 

I can include the necessary structures in the parent project, but I thought that by including the framework in the library project, the link would be OK.

My question is: Do I have to include all the frameworks that my dependent subprojects use in the parent project to ensure the correct binding, or am I doing something wrong?

Thank you for your help.

+4
source share
2 answers

If the subproject compiles to a static lib, yes.

+3
source

be sure to include "CoreMedia.framework", "AudioToolbox.framework", "CoreGraphics.framework", "CoreVideo.framework", "AVFoundation.framework", "libiconv.dylib", the frames in the project at the assembly stages

+9
source

Source: https://habr.com/ru/post/1340370/


All Articles