我正在尝试将OpenCV库的静态库链接到我的项目中,但是我收到了错误:
Undefined symbols for architecture armv7:
"__ZN2cv9ExceptionC1EiRKSsS2_S2_i", referenced from:
__ZL16icvGenerateQuadsPP8CvCBQuadPP10CvCBCornerP12CvMemStorageP5CvMati in libopencv_calib3d.a(calibinit.o)
_cvFindChessboardCorners in libopencv_calib3d.a(calibinit.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我不知道那个符号“ZN2cv9ExceptionC1EiRKSsS2_S2_i”应该是什么,在我用于构建静态库的任何源文件或头文件中找到的字母串。
对链接器更有经验的人是否可以向我解释这些错误?
编辑:01.07。还没有解决这个问题,只是选择了使用calib3d进行棋盘检测,并使用不会产生链接错误的features2D进行不太复杂的圆检测。
答案 0 :(得分:1)
最有可能的是你把OpenCV库放错了。请在链接列表中尝试以下顺序:
opencv_contrib opencv_legacy opencv_videostab opencv_photo opencv_stitching opencv_objdetect opencv_video opencv_ml opencv_calib3d opencv_features2d opencv_highgui opencv_flann opencv_imgproc opencv_core
答案 1 :(得分:0)
您可以使用c++filt
取消定义未定义的符号以查找实际的函数名称。
$ c++filt.exe __ZN2cv9ExceptionC1EiRKSsS2_S2_i
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)
然后,您必须确定哪个源文件包含此函数,并在与之对应的库中链接。