How to resolve iOS Link errors with OpenCV

I am trying to add the latest version of openCV to my iOS project, but when I compile, I get about 30 link errors:

Example:

Undefined symbols for architecture i386: "cv::merge(std::vector<cv::Mat, std::allocator<cv::Mat> > const&, cv::_OutputArray const&)", referenced from: 

I added the OpenCV framework, along with all the other necessary frameworks , in a dummy application with a simple video capture (following the guide in the link), and it worked fine.

I'm not sure why he could work so smoothly in one place, but not in another. My only thought is that I am compiling for different architectures between the two applications, but I think for both I am targeting armv7 and armv7s.

Any idea on what might cause link errors?

+2
ios linker opencv
Jan 06 '13 at 19:10
source share
1 answer

Check this out: (if you are using the LLVM compiler)

Goal> Build Settings> Apple LLVM 4.1 Compiler - Language> C ++ Standard Library
try to choose

 libstdc++ (GNU C++ standard library)` 

then try switching to

 libc++ (LLVM C++ standard library with C++11 support) 

libstdC ++ seems to work for older versions of openCV, libC ++ for newer versions. If you make a mistake (in any case), you will see such errors.

If this is not the case, open the build settings next to each project and check all the settings ...

I recently fought - see my question here , answer here and github example here . The github project includes an opencv framework compiled from the current source a few days ago. I am currently compiling a multipurpose sample that references a different version of the framework if compiled to 10.6 / XCode4.2 or 10.7 / XCode4.4 +. [On github here ]

Update

When prompted by @mikewoz, you may need to run the current openCV using libstdc++ so that it remains compatible with other frameworks. You can make the current build with libstdc++ compatible. For more details, see My answer to Mike's question:

OpenCV 2.4.3+ with libstdc ++ for iOS?

+13
Jan 6 '13 at 21:22
source share



All Articles