Undefined symbols for architecture x86_64:

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)
Answered by ssmith_c in 808591022

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.

Some of those symbols are from the CoreMedia framework and some are from the CoreVideo framework. You’ll have to add both af those frameworks to your invocation of the compiler driver?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

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.

Undefined symbols for architecture x86_64:
 
 
Q