Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Undefined symbols for architecture armv7" when importing STATIC LIBRARY that contains OPENCV functions

I developed a very simple application, using openCV for iOS. It worked fine until I decided to use that code in another project. The new project shows this armv7 error and I can't see where the problem is (please, see the last image).

I created a static lib file with my working code, which has the following architecture info: lib architecture

Then I compiled it into a *.a file and added the dyOpenCv.a and the DyOpenCV.h files to my main project, which has the following architecture configuration: Project architecture

But when I try to use the method within the header file DyOpenCV.h I get the following errors: armv7 error

Any ideas of what may be wrong?

like image 972
marcelosalloum Avatar asked Apr 26 '13 15:04

marcelosalloum


2 Answers

There were two issues related to linking libraries:

  1. Firstly, although my subproject had the opencv2.framework correctly added and linked to it, I also had to add the framework to my main project. This way I got rid of the cv::* linking problems;

  2. The second issue was related to my cross-compiling Objective-C++ configuration. Since I was using libc++ as my Standard Library, I had to add -lc++ to my Other Linker Flags. In case you are using libstdc++ as your Standard Library, you should add -lstdc++ instead.

After those changes, it all worked perfectly! Good luck!

like image 153
marcelosalloum Avatar answered Nov 12 '22 07:11

marcelosalloum


I think its because ur project is not linking to the C++ runtime .

Try adding libc++.dylib to ur linked Libraries.

like image 39
Jinah Adam Avatar answered Nov 12 '22 06:11

Jinah Adam