gpt4 book ai didi

c++ - Xcode 中关于 OpenCV 的链接错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:04:56 29 4
gpt4 key购买 nike

我正在使用 XCode4 和 OpenCV 2.3。我编译了一份 OpenCV。这是 .a 的信息:

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 文件中。如何解决?

谢谢,鞠躬。

架构 armv7 的 undefined symbol :

"___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: 未找到体系结构 armv7 的符号collect2: ld 返回 1 个退出状态

顺便说一句:当我将文件名设置为 .mm 时,链接器会报告内部编译器错误。总线错误。

最佳答案

您可以通过“Build Phases -> Link Binary With Libraries”设置与 c++ 标准库的链接

enter image description here

关于c++ - Xcode 中关于 OpenCV 的链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7701393/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com