Ask Your Question
1

Link error for only CascadeClassifier under 2.4.3 for iOS

asked 2012-11-27 23:03:07 -0600

John Brewer gravatar image

updated 2012-11-27 23:12:04 -0600

I've been trying to get my project CVFunhouse to build under OpenCV 2.4.3. I'm using the drop-in opencv.framework downloaded from the opencv.org home page, replacing the older version of the framework.

I've already dealt with the libstdc++ to libc++ change.

Now I'm getting link errors for a single module, CascadeClassifier.

Undefined symbols for architecture armv7: "cv::CascadeClassifier::detectMultiScale(cv::Mat const&, std::vector<cv::rect_<int>, std::allocator<cv::rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)", referenced from: -[CVFFaceDetect processIplImage:] in CVFFaceDetect.o "cv::CascadeClassifier::load(std::string const&)", referenced from: -[CVFFaceDetect processIplImage:] in CVFFaceDetect.o

This is weird because CVFunhouse uses lots of other OpenCV modules, and all the code using other OpenCV modules links fine. Has something changed about CascadeClassifier in 2.4.3?

The complete source for CVFunhouse can be found at:

https://github.com/jeradesign/CVFunhouse

in case that helps.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2012-12-02 21:44:40 -0600

John Brewer gravatar image

It turns out that even though I switched from libstdc++ to libc++, I was still compiling against libstdc++, so this lead to some of the method signatures not matching at link time. To fix this:

  • In the Build Settings tab for your project, scroll down to "Apple LLVM Compiler 4.1 - Language"
  • Set the setting "C++ Language Dialect" to "C++11 [-std=c++11]"
  • Set the setting "C++ Standard Library" to "libc++ (LLVM standard C++ library with C++11 support)"

(You'll also need to switch the C++ runtime library from libstdc++ to libc++ in the "Link Binary With Libraries" section of the "Build Phases" tab.)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-11-27 23:03:07 -0600

Seen: 3,342 times

Last updated: Dec 02 '12