Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiler errors after upgrading to Opencv 2.4.5 on iOS. Is there a quick fix to these issues?

Tags:

xcode

ios

opencv

After upgrading the openCV version on an existing iOS project, I get the following problems. I have tried playing around with compiler version and some other settings but I haven't found a solution.

Thanks.

Ld /Users/_____/Library/Developer/Xcode/DerivedData/_____-czzcfkvvtejzzacaookbbwcmfsdh/Build/Products/Debug-iphoneos/_____.app/_____ normal armv7
cd /Users/________/Desktop/________NewOpenCV
setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/_____/Library/Developer/Xcode/DerivedData/________-czzcfkvvtejzzacaookbbwcmfsdh/Build/Products/Debug-iphoneos -L/Users/________/Desktop/________NewOpenCV/../../Downloads/opencv2.framework/Versions/A -F/Users/________/Library/Developer/Xcode/DerivedData/________-czzcfkvvtejzzacaookbbwcmfsdh/Build/Products/Debug-iphoneos -F/Users/________/Desktop/________NewOpenCV -F/Users/________/Desktop/________NewOpenCV/../../Downloads/aptogo-OpenCVForiPhone-cb262eb -F/Users/________/Desktop/________NewOpenCV/../../Downloads -filelist /Users/________/Library/Developer/Xcode/DerivedData/________-czzcfkvvtejzzacaookbbwcmfsdh/Build/Intermediates/________.build/Debug-iphoneos/________.build/Objects-normal/armv7/________.LinkFileList -dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=5.0 /Users/________/Desktop/________NewOpenCV/../../Downloads/opencv2.framework/Versions/A/opencv2 -framework CoreMotion -framework AudioToolbox -framework CoreLocation -lz.1.2.5 -framework ExternalAccessory -framework CFNetwork -framework SystemConfiguration -framework MobileCoreServices -framework AVFoundation -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/________/Library/Developer/Xcode/DerivedData/________-czzcfkvvtejzzacaookbbwcmfsdh/Build/Products/Debug-iphoneos/________.app/________

Undefined symbols for architecture armv7:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
  cv::Exception::Exception(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in opencv2(system.o)
  cv::error(cv::Exception const&) in opencv2(system.o)
  _cvRegisterModule in opencv2(system.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
  cv::Exception::formatMessage() in opencv2(system.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
  cv::medianBlur(cv::_InputArray const&, cv::_OutputArray const&, int) in opencv2(smooth.o)
  cv::Mat::create(int, int const*, int) in opencv2(matrix.o)
  cv::setSize(cv::Mat&, int, int const*, unsigned long const*, bool) in opencv2(matrix.o)
  cv::Mat::Mat(cv::Mat const&, cv::Range const&, cv::Range const&) in opencv2(matrix.o)
  cv::Mat::Mat(cv::Mat const&, cv::Range const*) in opencv2(matrix.o)
  cv::Mat::diag(int) const in opencv2(matrix.o)
  cv::Mat::Mat(_IplImage const*, bool) in opencv2(matrix.o)
  ...
 "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
  cv::medianBlur(cv::_InputArray const&, cv::_OutputArray const&, int) in opencv2(smooth.o)
  cv::Mat::create(int, int const*, int) in opencv2(matrix.o)
  cv::setSize(cv::Mat&, int, int const*, unsigned long const*, bool) in opencv2(matrix.o)
  cv::Mat::Mat(cv::Mat const&, cv::Range const&, cv::Range const&) in opencv2(matrix.o)
  cv::Mat::Mat(cv::Mat const&, cv::Range const*) in opencv2(matrix.o)
  cv::Mat::diag(int) const in opencv2(matrix.o)
  cv::Mat::Mat(_IplImage const*, bool) in opencv2(matrix.o)
  ...
 "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
  cv::medianBlur(cv::_InputArray const&, cv::_OutputArray const&, int) in opencv2(smooth.o)
  std::__1::vector<int, std::__1::allocator<int> >::__append(unsigned long) in opencv2(smooth.o)
  std::__1::vector<cv::Vec<int, 128>, std::__1::allocator<cv::Vec<int, 128> > >::__append(unsigned long) in opencv2(matrix.o)
  std::__1::vector<cv::Vec<int, 64>, std::__1::allocator<cv::Vec<int, 64> > >::__append(unsigned long) in opencv2(matrix.o)
  std::__1::vector<cv::Vec<int, 32>, std::__1::allocator<cv::Vec<int, 32> > >::__append(unsigned long) in opencv2(matrix.o)
  std::__1::vector<cv::Vec<int, 16>, std::__1::allocator<cv::Vec<int, 16> > >::__append(unsigned long) in opencv2(matrix.o)
  std::__1::vector<cv::Vec<int, 12>, std::__1::allocator<cv::Vec<int, 12> > >::__append(unsigned long) in opencv2(matrix.o)
  ...
"cv::split(cv::Mat const&, std::vector<cv::Mat, std::allocator<cv::Mat> >&)", referenced from:
  GetRegionContoursLDC(cv::Mat&, double, double, double, double, int, std::vector<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >, std::allocator<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > > >&) in GetRegionContoursLDC.o
"cv::putText(cv::Mat&, std::string const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)", referenced from:
  -[NotesUploaderViewController addMotionDetails:] in NotesUploaderViewController.o
  -[NotesUploaderViewController addArea:atPoint:onto:] in NotesUploaderViewController.o
  -[NotesUploaderViewController addMeasureLine:toPoint:usingScale:onto:] in NotesUploaderViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
like image 528
user2597120 Avatar asked Nov 03 '22 18:11

user2597120


1 Answers

I was accidentally including the OpenCV Unix executable file instead of the framework (in the linked frameworks and libraries section). I also had to include the libc++.dylib file as mentioned in this answer.

like image 64
user2597120 Avatar answered Nov 13 '22 08:11

user2597120