编译ORB-SLAM2提示:undefined reference to symbol '_ZN2cv6String10deallocateEv'

环境

Ubuntu 14.04 +opencv3.3.1 +ROS indigo

编译orb-slam2,报错:undefined reference to symbol '_ZN2cv6String10deallocateEv'

详细报错信息如下:

/usr/bin/ld: warning: libopencv_core.so.3.3, needed by ../Thirdparty/DBoW2/lib/libDBoW2.so, may conflict with libopencv_core.so.2.4
/usr/bin/ld: CMakeFiles/rgbd_tum.dir/Examples/RGB-D/rgbd_tum.cc.o: undefined reference to symbol '_ZN2cv6String10deallocateEv'
//usr/local/lib/libopencv_core.so.3.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [../Examples/RGB-D/rgbd_tum] Error 1
make[1]: *** [CMakeFiles/rgbd_tum.dir/all] Error 2
/usr/bin/ld: warning: libopencv_core.so.3.3, needed by ../Thirdparty/DBoW2/lib/libDBoW2.so, may conflict with libopencv_core.so.2.4
/usr/bin/ld: CMakeFiles/mono_kitti.dir/Examples/Monocular/mono_kitti.cc.o: undefined reference to symbol '_ZN2cv6String10deallocateEv'
//usr/local/lib/libopencv_core.so.3.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [../Examples/Monocular/mono_kitti] Error 1
make[1]: *** [CMakeFiles/mono_kitti.dir/all] Error 2
Linking CXX executable ../Examples/Stereo/stereo_kitti
/usr/bin/ld: warning: libopencv_core.so.3.3, needed by ../Thirdparty/DBoW2/lib/libDBoW2.so, may conflict with libopencv_core.so.2.4
/usr/bin/ld: CMakeFiles/stereo_kitti.dir/Examples/Stereo/stereo_kitti.cc.o: undefined reference to symbol '_ZN2cv6String10deallocateEv'
//usr/local/lib/libopencv_core.so.3.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [../Examples/Stereo/stereo_kitti] Error 1
make[1]: *** [CMakeFiles/stereo_kitti.dir/all] Error 2
make: *** [all] Error 2

解决方案

编辑CMakeLists.txt,把find_package(OpenCV 2.4.9 REQUIRED)中的版本号改为自己装的opencv版本号即可。

你可能感兴趣的:(slam,计算机视觉,ros,机器人,opencv)