Question

What I have done is used some code from the tutorial based on the openCV framework. From the EdgeDetectionSample.cpp file, I import the code.

Undefined symbols for architecture armv7: "std::__1::basic_string, std::__1::allocator >::basic_string(std::__1::basic_string, std::__1::allocator > const&)", referenced from: cv::Exception::Exception(int, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, int) in opencv2(system.o) cv::Exception::Exception(cv::Exception const&) in opencv2(system.o) "std::__1::basic_string, std::__1::allocator >::~basic_string()", referenced from: cv::Mat::create(int, int const*, int) in opencv2(matrix.o) __ZN2cvL7setSizeERNS_3MatEiPKiPKmb 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) cv::Mat::reserve(unsigned long) in opencv2(matrix.o) ... "std::__1::basic_string, std::__1::allocator >::__init(char const*, unsigned long)", referenced from: cv::Mat::create(int, int const*, int) in opencv2(matrix.o) __ZN2cvL7setSizeERNS_3MatEiPKiPKmb 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) cv::Mat::reserve(unsigned long) in opencv2(matrix.o) ... "std::_1::_vector_base_common::__throw_length_error() const", referenced from: std::_1::vector, std::__1::allocator > >::_append(unsigned long) in opencv2(matrix.o) std::_1::vector, std::__1::allocator > >::_append(unsigned long) in opencv2(matrix.o) std::_1::vector, std::__1::allocator > >::_append(unsigned long) in opencv2(matrix.o) std::_1::vector, std::__1::allocator > >::_append(unsigned long) in opencv2(matrix.o) std::_1::vector, std::__1::allocator > >::_append(unsigned long) in opencv2(matrix.o) std::_1::vector, std::__1::allocator > >::_append(unsigned long) in opencv2(matrix.o) std::_1::vector, std::__1::allocator > >::_append(unsigned long) in opencv2(matrix.o) ... "std::__1::basic_string, std::__1::allocator >::operator=(std::__1::basic_string, std::__1::allocator > const&)", referenced from: cv::Exception::formatMessage() in opencv2(system.o) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please Help me Out with this. I am not able to get read of those errors.

Was it helpful?

Solution

Your project is linked against libstd++ (GNU C++ standard library), but latest OpenCV was linked against libc++ (LLVM C++ standard library with C++ 11 support), so you have two ways to fix this:

  1. Link you project against libc++
  2. Rebuild OpenCV with libstd++.

To link your project with libc++, go to -> Build Settings -> find 'C++ standard library' row and select libc++ there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top