我正在使用XCode4和OpenCV 2.3。 我編譯了一個OpenCV的副本。這裏是.a的信息:有關Xcode中OpenCV的鏈接錯誤
libopencv_core.a: Mach-O universal binary with 3 architectures
libopencv_core.a (for architecture armv7): current ar archive random library
libopencv_core.a (for architecture armv6): current ar archive random library
libopencv_core.a (for architecture i386): current ar archive random library
我把它拖到Frameworks floder中,並設置庫搜索的正確路徑。 但是當我編譯時,它發生了這樣的錯誤:
看來,在OpenCV庫中使用的STL沒有鏈接在.a文件中。 如何解決它?
謝謝,鞠躬。符號(S)沒有發現建築的ARMv7 collect2:用於建築的ARMv7
未定義的符號:
"___cxa_begin_catch", referenced from:
icvReadSeq(CvFileStorage*, CvFileNode*) in libopencv_core.a(persistence.o)
"typeinfo for std::exception", referenced from:
typeinfo for cv::Exceptionin libopencv_core.a(alloc.o)
"operator delete(void*)", referenced from:
cv::Exception::~Exception()in libopencv_core.a(alloc.o)
"_gzputs", referenced from:
icvPuts(CvFileStorage*, char const*)in libopencv_core.a(persistence.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&)", referenced from:
cv::OutOfMemoryError(unsigned long)in libopencv_core.a(alloc.o)
cv::Exception::~Exception()in libopencv_core.a(alloc.o)
cv::Exception::~Exception()in libopencv_core.a(alloc.o)
_cvCreateMatHeader in libopencv_core.a(array.o)
_cvGetImageCOI in libopencv_core.a(array.o)
_cvSetImageCOI in libopencv_core.a(array.o)
_cvGetSize in libopencv_core.a(array.o)
...
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
cv::OutOfMemoryError(unsigned long)in libopencv_core.a(alloc.o)
cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)in libopencv_core.a(array.o)
_cvRegisterModule in libopencv_core.a(system.o)
"___cxa_throw", referenced from:
cv::error(cv::Exception const&)in libopencv_core.a(system.o)
"___cxa_end_catch", referenced from:
icvReadSeq(CvFileStorage*, CvFileNode*) in libopencv_core.a(persistence.o)
"_cvCvtColor", referenced from:
-[cviosViewController CreateIplImageFromUIImage:] in cviosViewController.o
"vtable for std::exception", referenced from:
cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)in libopencv_core.a(array.o)
cv::error(cv::Exception const&)in libopencv_core.a(system.o)
"operator new[](unsigned long)", referenced from:
cv::mixChannels(cv::Mat const*, unsigned long, cv::Mat*, unsigned long, int const*, unsigned long)in libopencv_core.a(convert.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
cv::OutOfMemoryError(unsigned long)in libopencv_core.a(alloc.o)
cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)in libopencv_core.a(array.o)
cv::error(cv::Exception const&)in libopencv_core.a(system.o)
_cvRegisterModule in libopencv_core.a(system.o)
"vtable for __cxxabiv1::__si_class_type_info", referenced from:
typeinfo for cv::Exceptionin libopencv_core.a(alloc.o)
"std::terminate()", referenced from:
cv::error(cv::Exception const&)in libopencv_core.a(system.o)
"___cxa_allocate_exception", referenced from:
cv::error(cv::Exception const&)in libopencv_core.a(system.o)
"___gxx_personality_sj0", referenced from:
cv::OutOfMemoryError(unsigned long)in libopencv_core.a(alloc.o)
_cvCreateMatHeader in libopencv_core.a(array.o)
_cvGetImageCOI in libopencv_core.a(array.o)
_cvSetImageCOI in libopencv_core.a(array.o)
_cvGetSize in libopencv_core.a(array.o)
_cvGetDims in libopencv_core.a(array.o)
_cvGetElemType in libopencv_core.a(array.o)
...
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
cv::OutOfMemoryError(unsigned long)in libopencv_core.a(alloc.o)
_cvCreateMatHeader in libopencv_core.a(array.o)
_cvGetImageCOI in libopencv_core.a(array.o)
_cvSetImageCOI in libopencv_core.a(array.o)
_cvGetSize in libopencv_core.a(array.o)
_cvGetDims in libopencv_core.a(array.o)
_cvGetElemType in libopencv_core.a(array.o)
...
"operator delete[](void*)", referenced from:
cv::mixChannels(cv::Mat const*, unsigned long, cv::Mat*, unsigned long, int const*, unsigned long)in libopencv_core.a(convert.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage", referenced from:
cv::OutOfMemoryError(unsigned long)in libopencv_core.a(alloc.o)
cv::Exception::~Exception()in libopencv_core.a(alloc.o)
cv::Exception::~Exception()in libopencv_core.a(alloc.o)
_cvCreateMatHeader in libopencv_core.a(array.o)
_cvGetImageCOI in libopencv_core.a(array.o)
_cvSetImageCOI in libopencv_core.a(array.o)
_cvGetSize in libopencv_core.a(array.o)
...
"std::exception::~exception()", referenced from:
cv::OutOfMemoryError(unsigned long)in libopencv_core.a(alloc.o)
cv::Exception::~Exception()in libopencv_core.a(alloc.o)
cv::Exception::~Exception()in libopencv_core.a(alloc.o)
cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)in libopencv_core.a(array.o)
cv::error(cv::Exception const&)in libopencv_core.a(system.o)
_cvRegisterModule in libopencv_core.a(system.o)
LD LD返回1退出狀態
BTW:當我設置的文件名。毫米,鏈接器報告內部編譯器錯誤。總線錯誤。
一個.a文件從來沒有鏈接過,你是否嘗試過把C++庫鏈接到你的可執行文件,用gcc,這將會添加-lstdC++, –
大衛,你剛剛救了我一個頭痛的問題,也許這應該是一個正式的答案而不是評論,將+1作爲答案,而不是評論的+1。 – imnk