2014-01-20 48 views
6

我已經得到了來自OpenCV的的precompiled opencv2.framework,我已經把它添加到我的項目。然而試圖編譯該項目給出了類似的錯誤:OpenCV的框架:符號(S)未找到的ARMv7架構

Undefined symbols for architecture armv7: 
    "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from: 
     std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >::__append(unsigned long) in opencv2(matrix.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) 
     std::__1::vector<cv::Vec<int, 9>, std::__1::allocator<cv::Vec<int, 9> > >::__append(unsigned long) in opencv2(matrix.o) 
     ... 
    "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) 
    "_OBJC_CLASS_$_ALAssetsLibrary", referenced from: 
     objc-class-ref in opencv2(cap_ios_video_camera.o) 
    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from: 
     cv::sum(cv::_InputArray const&) in opencv2(stat.o) 
     cv::countNonZero(cv::_InputArray const&) in opencv2(stat.o) 
     cv::mean(cv::_InputArray const&, cv::_InputArray const&) in opencv2(stat.o) 
     cv::meanStdDev(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_InputArray const&) in opencv2(stat.o) 
     cv::minMaxIdx(cv::_InputArray const&, double*, double*, int*, int*, cv::_InputArray const&) in opencv2(stat.o) 
     cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&) in opencv2(stat.o) 
     cv::norm(cv::_InputArray const&, int, cv::_InputArray const&) in opencv2(stat.o) 
     ... 
    "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from: 
     cv::sum(cv::_InputArray const&) in opencv2(stat.o) 
     cv::countNonZero(cv::_InputArray const&) in opencv2(stat.o) 
     cv::mean(cv::_InputArray const&, cv::_InputArray const&) in opencv2(stat.o) 
     cv::meanStdDev(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_InputArray const&) in opencv2(stat.o) 
     cv::minMaxIdx(cv::_InputArray const&, double*, double*, int*, int*, cv::_InputArray const&) in opencv2(stat.o) 
     cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&) in opencv2(stat.o) 
     cv::norm(cv::_InputArray const&, int, cv::_InputArray const&) in opencv2(stat.o) 
     ... 
ld: symbol(s) not found for architecture armv7 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

我設置構建有效的架構在我的構建設置只有沒有,但它仍然發生。我需要做些什麼來讓OpenCV工作?我正在使用XCode 5,目標是iOS7。

我已經added -lstdc++ to linker flags and switch the C++ compiler to libstdc++, as-per this answer

我已經嘗試從源代碼編譯OpenCV,但也會產生相同的錯誤。

無論我是否將iOS6或7作爲部署目標,情況都是如此。

+0

你有沒有找到解決辦法? – aledalgrande

回答

15

兩件事情你應該檢查:

  1. 您正在嘗試使用OpenCV的,但Xcode中/鐺的C++部分是非常字面。如果您鏈接的文件是.m,它會將其視爲Objective-C。相反,我們希望通過重命名或者擴展到.mm或者在右側欄中造就了該文件的屬性和的類型選擇Objective-C++ Source把它當作一個Objective-C++文件。

  2. ALAssetsLibraryAssetsLibrary.framework定義,請把它添加到您的鏈接二進制與圖書館一步爲您的項目。

+1

我錯過了AssetsLibrary。謝謝! – jaime

相關問題