编译darknet_ros时报错:OpenCV 4.x+ requires enabled C++11 support

链接: link

分析:因为安装的ubuntu版本是20.04,对应安的noetic包里自带的是Opencv4.2,因此需要更改ros编译时使用的opencv版本。

解决:打开/opt/ros/noetic/share/cv_bridge/cmake/cv_bridgeConfig.cmake文件,做以下更改:(注释掉的是源代码,后边是更改后的)


#if(NOT "include;/usr/include/opencv4 " STREQUAL " ")

if(NOT "include;/usr/local/include/opencv; /usr/local/include/opencv2 " STREQUAL " ")

set(cv_bridge_INCLUDE_DIRS "")

#set(_include_dirs "include;/usr/include/opencv4")

set(_include_dirs "include;/usr/local/lib;/usr/local/include/opencv;/usr/local/include/opencv2;/usr/local/include;/usr/include")

之后再安装一个Opencv 3.x的版本即可
可参考链接安装:

你可能感兴趣的:(ROS,常见,知识点总结,无人机,ROS,人工智能,opencv,c++,人工智能)