Undefined symbols for architecture x86_64 error when linking OpenCV in Xcode Undefined symbols for architecture x86_64 error when linking OpenCV in Xcode xcode xcode

Undefined symbols for architecture x86_64 error when linking OpenCV in Xcode


In Xcode create a new group inside your project, right click it, choose Add Files to Project, navigate to the /usr/local/lib folder and add the following basic libraries:

libopencv_core.dylib, libopencv_ml.dylib, libopencv_video.dylib

In previous versions of OpenCV the library names could be:

libcxcore.dylib, libcvaux.dylib, libcv.dylib, libhighgui.dylib, libml.dylib

(The libraries may be in another path depending on the method you used to install OpenCV on your Mac.)

Edit:

The above lines should not be necessary if you are including the dynamic libraries in the linking phase as the OP explains.

Select your project, go to the Build Settings tab, filter by c++ standard library, and set this parameter to libstdc++ (GNU C++ standard library).


I've set the Build Settings -> c++ standard library to Compiler Default. The errors disappeared.


I had to add the following libraries (build phases -> link binary with libraries) so OpenCV would build:

  • Accelerate
  • AssetsLibrary
  • AVFoundation
  • CoreGraphics
  • CoreImage
  • CoreMedia
  • CoreVideo
  • QuartzCore
  • UIKit
  • Foundation

Ref: http://docs.opencv.org/doc/tutorials/ios/video_processing/video_processing.html#opencviosvideoprocessing