使用catkin_make编译ROS代码时报错如下:
CMake Error at
/opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113
(message): Project ‘cv_bridge’ specifies ‘/usr/include/opencv’ as an
include dir, which is not found. It does neither exist as an
absolute directory nor in ‘${{prefix}}//usr/include/opencv’. Check
the issue tracker
‘https://github.com/ros-perception/vision_opencv/issues’ and consider
creating a ticket if the problem has not been reported yet.
解决办法:在根目录下搜索OPENCV的安装路径
我的路径如下:在/usr/include/opencv4/opencv2路径下
然后打开报错中提示的文件/opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake,在其中搜索/usr/include/opencv,并用自己的路径/usr/include/opencv4/opencv2替换,如下:
然后重新编译即可