报错如下:
<pre><font color="#EF2929"><b>CMake Error</b></font> at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
</pre>
可以看到最后一行显示了在那个包中出现了错误,我们打开racecar_gazebo包下的cmakelists,
如下设置了
opencv的地址,原来写的是 set(Opencv_DIR /opt/ros/kinetic/share/OpenCV-3.3.1-dev),
可以看到用的是地址里ros/kinetic的,应该是kinetic版本的ros自带opencv,opencv的配置文件是OpenCVConfig.cmake
因此我在最根目录搜索了一下
这里可以看到许多个文件,这里我是安装过opencv3.2,没有安装我不知道能不能搜到,搜到的话把其地址复制替换刚刚cmakelist内的地址,我这里用的第一个文件地址替换的,然后再次catkin_make成功!!
注意:如果没有搜到OpenCVConfig.cmake,请额外安装opencv,我安装的是3.2版本,建议也安装此版本,我这里有安装过程中下载不成功需要自己放入进去的缺失文件,免费0积分下载{搜索“opencv3.2安装过程中缺失文件”},至于怎么用等你需要安装opencv的时候,哪些教程里面都会有说明安装的时候报错有些文件
boostdesc_bgm.i
boostdesc_bgm_bi.i
boostdesc_bgm_hd.i
boostdesc_lbgm.i
boostdesc_binboost_064.i
boostdesc_binboost_128.i
boostdesc_binboost_256.i
vgg_generated_120.i
vgg_generated_64.i
vgg_generated_80.i
vgg_generated_48.i