iOS6 + Opencv (Latest Compile) Linker Only for classes in Feature2D module

asked 2013-01-18 20:01:52 -0500

hardboy111 gravatar image

updated 2013-01-21 03:27:44 -0500


So I managed to successfully compile the latest opencv source and generate the opencv2.framework. I also successfully implemented this tutorial (

I then started to modify my code to add in some feature detection code. I included the module #import <opencv2 features2d="" features2d.hpp=""> and started to code including some key classes and methods needed. The intellisense recognised these classes as I started to type e.g.


But then when I tried to build I got linker errors for these classes and method calls. Im confused as I know I have the latest version of opencv framework as the video tutorial all worked fine. The specific errors are shown below. Can anyone suggest why I have problems using the Feature2D module on iOS?

    Ld /Users/mh/Library/Developer/Xcode/DerivedData/Cukamo-fzqnynxgvslzftbswmivdfpiuqdy/Build/Products/Debug-iphoneos/ normal armv7
    cd "/Users/mh/Documents/iOS Projects/Business/Cukamo"
    setenv PATH "/Applications/"
    /Applications/ -arch armv7 -isysroot /Applications/ -L/Users/mh/Library/Developer/Xcode/DerivedData/Cukamo-fzqnynxgvslzftbswmivdfpiuqdy/Build/Products/Debug-iphoneos "-L/Users/mh/Documents/iOS Projects/Business/Cukamo/Cukamo/tesseract-ios-lib/lib" "-L/Users/mh/Documents/iOS Projects/Business/Cukamo/Cukamo" -F/Users/mh/Library/Developer/Xcode/DerivedData/Cukamo-fzqnynxgvslzftbswmivdfpiuqdy/Build/Products/Debug-iphoneos "-F/Users/mh/Documents/iOS Projects/Business/Cukamo" "-F/Users/mh/Documents/iOS Projects/Business/Cukamo/../../../../opencv/ios" -filelist /Users/,h/Library/Developer/Xcode/DerivedData/Cukamo-fzqnynxgvslzftbswmivdfpiuqdy/Build/Intermediates/ -dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework opencv2 -lc++ -framework CoreMedia -framework CoreVideo -framework CoreGraphics -framework QuartzCore -framework CoreImage -framework AVFoundation -framework AssetsLibrary -framework Accelerate -framework UIKit -framework Foundation -llept -ltesseract_all -o /Users/mh/Library/Developer/Xcode/DerivedData/Cukamo-fzqnynxgvslzftbswmivdfpiuqdy/Build/Products/Debug-iphoneos/

Undefined symbols for architecture armv7:
  "cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const", referenced from:
      -[ViewController processImage:] in ViewController.o
  "cv::Algorithm::_create(std::string const&)", referenced from:
      cv::Ptr<cv::FeatureDetector> cv::Algorithm::create<cv::FeatureDetector>(std::string const&) in ViewController.o
      cv::Ptr<cv::DescriptorExtractor> cv::Algorithm::create<cv::DescriptorExtractor>(std::string const&) in ViewController.o
  "cv::Feature2D::create(std::string const&)", referenced from:
      -[ViewController processImage:] in ViewController.o
  "cv::FeatureDetector::detect(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat const&) const", referenced from:
      -[ViewController processImage:] in ViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
edit retag flag offensive close merge delete


any one? i havent a clue what the problem is - normally linker errors result from a framework not included but it definitely is! :(

hardboy111 gravatar imagehardboy111 ( 2013-01-21 03:33:41 -0500 )edit

Hi. Do you get linker errors related to features2d module only? Does "cv::Mat::eye(3,3, CV_8UC1)" cause linker errors too?

BloodAxe gravatar imageBloodAxe ( 2013-01-23 04:19:12 -0500 )edit

Hi, cv::Mat::eye(3,3, CV_8UC1) did not cause any linker errors - compiled ok.

hardboy111 gravatar imagehardboy111 ( 2013-01-26 08:37:59 -0500 )edit

is this true that brisk isnt actually included in the standard opencv build? Could this be a reason why it does not recognise the symbols?

hardboy111 gravatar imagehardboy111 ( 2013-01-26 09:16:11 -0500 )edit

I also invesigated the /features2d/include/opencv2/features2d/features2d.hpp file and found it has a depedency on the module "opencv2/flann/flann.hpp". But when I try and include this in my code it does not exist. Does this mean anything ?

hardboy111 gravatar imagehardboy111 ( 2013-01-26 09:32:31 -0500 )edit

..i also found someone with a similar issue here but the solution didnt help

hardboy111 gravatar imagehardboy111 ( 2013-01-26 10:53:00 -0500 )edit

Does someone have a ios6 project template sample that uses features2D without linker this point im willing to make a donation if someone could share it with me :)

hardboy111 gravatar imagehardboy111 ( 2013-01-26 11:00:36 -0500 )edit

In your build settings under Apple LLVM compiler have you tried setting the C++ Standard Library to "LLVM C++ standard library with C++11 support"?

christoph gravatar imagechristoph ( 2013-01-31 03:55:32 -0500 )edit

Did you change your c++ file extension to .mm?

ske gravatar imageske ( 2013-04-11 05:58:09 -0500 )edit

Yes, I am using the c++ file extension .mm, and the same error. exactly the same with , can not find a solution, can anyone give a help?

Maybe this is the answer?, it is non free

Kevin gravatar imageKevin ( 2013-04-16 04:51:08 -0500 )edit