I am developing a simple camera JNI interface program in Objc. I managed to compile. But I get the following link error. I use the following command. Is there anything I can add to solve this problem? Note that I use Intel MacMini.
g++ -framework Foundation -framework AVFoundation CameraMacOS.m
Undefined symbols for architecture x86_64:
"_CMVideoFormatDescriptionGetDimensions", referenced from:
_openCamera in CameraMacOS-517c44.o
_listWebcamNamesAndSizes in CameraMacOS-517c44.o
"_CVPixelBufferGetBaseAddress", referenced from:
-[CaptureDelegate captureOutput:didFinishProcessingPhoto:error:] in CameraMacOS-517c44.o
"_CVPixelBufferGetBytesPerRow", referenced from:
-[CaptureDelegate captureOutput:didFinishProcessingPhoto:error:] in CameraMacOS-517c44.o
"_CVPixelBufferGetHeight", referenced from:
-[CaptureDelegate captureOutput:didFinishProcessingPhoto:error:] in CameraMacOS-517c44.o
"_CVPixelBufferGetWidth", referenced from:
-[CaptureDelegate captureOutput:didFinishProcessingPhoto:error:] in CameraMacOS-517c44.o
"_CVPixelBufferLockBaseAddress", referenced from:
-[CaptureDelegate captureOutput:didFinishProcessingPhoto:error:] in CameraMacOS-517c44.o
"_CVPixelBufferUnlockBaseAddress", referenced from:
-[CaptureDelegate captureOutput:didFinishProcessingPhoto:error:] in CameraMacOS-517c44.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
if you look up CVPixelBufferGetBaseAddress in Xcode's developer documentation, you'll see it is in the Core Video framework. Similarly, CMVideoFormatDescriptionGetDimensions is in the Core Media framework.
So I think you need to add CoreMedia and CoreVideo to your framework includes.