JavaCake
JavaCake

Reputation: 4115

Build error using Featured2D in OpenCV with XCode

I have been fighting with an build error when using Features2D in OpenCV which i cannot figure out why.

The build error:

Undefined symbols for architecture x86_64:
"cv::FeatureDetector::detect(cv::Mat const&, std::__debug::vector<cv::KeyPoint,     std::allocator<cv::KeyPoint> >&, cv::Mat const&) const", referenced from:
  analysis::openCvStitching() in analysis.o
"cv::DescriptorMatcher::match(cv::Mat const&, cv::Mat const&, std::__debug::vector<cv::DMatch, std::allocator<cv::DMatch> >&, cv::Mat const&) const", referenced from:
  analysis::openCvStitching() in analysis.o
"cv::DescriptorExtractor::compute(cv::Mat const&, std::__debug::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const", referenced from:
  analysis::openCvStitching() in analysis.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is how i create a pointer to the FeatureDetector and DescriptorExtractor:

Ptr<FeatureDetector> surfDetector = FeatureDetector::create(type);
Ptr<DescriptorExtractor> surfExtractor = DescriptorExtractor::create(type);

Upvotes: 1

Views: 699

Answers (1)

yiding
yiding

Reputation: 3592

Have you tried deleting _GLIBCXX_DEBUG=1 and/or _GLIBCXX_DEBUG_PEDANTIC=1 from the preprocessor flags in your project settings? opencv2 c++ api is somewhat bad in its use of STL templates in the API functions, which may cause linker errors or crashes if your version of the standard libraries or compiler flags do not match exactly with what's used when it was compiled.

Upvotes: 3

Related Questions