- 在CmakeLists中 屏蔽ROS自带的Opencv库
file(GLOB_RECURSE OLD_OPENCV "/usr/lib/x86_64-linux-gnu/libopencv*")
list(REMOVE_ITEM catkin_LIBRARIES ${OLD_OPENCV})
- 此时可能 cv_brige 也会发生冲突,因为默认的 cv_brige 也是和 Opencv4 配套使用
/usr/bin/ld: warning: libopencv_core.so.4.2, needed by /opt/ros/noetic/lib/libcv_bridge.so, may conflict with libopencv_core.so.3.4
/usr/bin/ld: CMakeFiles/vins_node.dir/src/vslam.cpp.o: undefined reference to symbol '_ZNK2cv8FileNodecviEv'
/usr/bin/ld: /lib/x86_64-linux-gnu/libopencv_core.so.4.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [vslam/CMakeFiles/vins_node.dir/build.make:267: lib/vins/vins_node] Error 1
make[1]: *** [CMakeFiles/Makefile2:12727: CMakeFiles/vins_node.dir/all] Error 2
需要修改如下内容:文章来源:https://www.toymoban.com/news/detail-720676.html
/opt/ros/noetic/share/cv_bridge/cmake$ sudo vim cv_bridgeConfig.cmake
1.头文件目录:修改为安装opencv3的路径
2.库目录:需要什么库链接什么库就够了
文章来源地址https://www.toymoban.com/news/detail-720676.html
到了这里,关于编译工程需要Opencv3 与 ROS自带Opencv4冲突解决办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!