Linker errors after upgrading Xcode to 4.5.2 and OpenCV to 2.4.3

asked 2012-12-25 06:49:59 -0500

alonsh4 gravatar image

updated 2012-12-25 08:50:30 -0500

My project was working just fine until this morning. I was using xcode 4.3, and an older version of OpenCV (I'm not sure about the exact version). OSX was already 10.7.x, but not 10.7.5

Today, after upgrading OSX to 10.7.5, xcode to 4.5.2, and downloading OpenCV 2.4.3, I am getting the following linker errors when trying to build the project:

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ALAssetsLibrary", referenced from:
objc-class-ref in opencv2(cap_ios_video_camera.o)
"cv::FeatureDetector::create(std::string const&)", referenced from:
-[ImageAnalyzer detectBlobs:] in ImageAnalyzer.o
"cv::FeatureDetector::detect(cv::Mat const&, std::vector >&, cv::Mat const&) const", referenced from:
-[ImageAnalyzer detectBlobs:] in ImageAnalyzer.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

In order to use the new opencv framework I removed the reference to the old framework, and referenced the project to the official prebuilt opencv2.framework. I also removed the reference to libz.dylib, and added a reference to libc++.dylib instead. Last step was to update the prefix file to the new framework. The relevant part in the prefix file now looks like this:

#ifdef __cplusplus
#import <opencv2/opencv.hpp>

t all narrowed down to these 4 linker errors I can't seem to get rid of. I tried using libstdc++.dylib, but I am getting even more errors. I also tried building OpenCV myself as explained in the wiki, but I am still getting the same errors as the prebuilt framework.

What am I doing wrong?

As seen here, setting the "C++ Standard Library" to "libc++ (LLVM C++ standard libray with C++ 11 support" yielded only one error:

clang: error: invalid deployment target for -stdlib=libc++ (requires iOS 5.0 or later)

Changing the deployment target to iOS 5 finally got my project to run again. Does this mean OpenCV 2.4.3 doesn't work on iOS versions older than 5?

edit retag flag offensive close merge delete