Darknet_ros Install Issue, OpenCV 4.x+ requires enabled C++11 error
Hello there, I'm trying to install darknet_ros on the Jetson Xavier running ubuntu 18.04 with JetPack 4.4.1, I couldn't find any guide specific to jetson platforms so I used the installation steps on the main github page for the project.
I'm not able to do the catkin_make command successfully, below is the last part of the catkin_make output:
[ 68%] Building C object darknet_ros/darknet_ros/CMakeFiles/darknet_ros_lib.dir/__/darknet/src/activation_layer.c.o
[ 69%] Building C object darknet_ros/darknet_ros/CMakeFiles/darknet_ros_lib.dir/src/image_interface.c.o
[ 71%] Built target rtabmap_sync
[ 71%] Building C object darknet_ros/darknet_ros/CMakeFiles/darknet_ros_lib.dir/__/darknet/src/activations.c.o
[ 72%] Built target rtabmap_wifi_signal_pub
[ 75%] Built target rtabmap_rviz_plugins
[ 75%] Built target rtabmap_wifi_signal_sub
[ 75%] Building C object darknet_ros/darknet_ros/CMakeFiles/darknet_ros_lib.dir/__/darknet/src/image.c.o
[ 76%] Built target rtabmap_map_assembler
[ 77%] Building C object darknet_ros/darknet_ros/CMakeFiles/darknet_ros_lib.dir/__/darknet/src/avgpool_layer.c.o
[ 77%] Building C object darknet_ros/darknet_ros/CMakeFiles/darknet_ros_lib.dir/__/darknet/src/layer.c.o
[ 78%] Built target rtabmapviz
[ 84%] Built target rtabmap_plugins
[ 84%] Building C object darknet_ros/darknet_ros/CMakeFiles/darknet_ros_lib.dir/__/darknet/src/batchnorm_layer.c.o
[ 84%] Building C object darknet_ros/darknet_ros/CMakeFiles/darknet_ros_lib.dir/__/darknet/src/list.c.o
In file included from /usr/include/opencv4/opencv2/core/types_c.h:82:0,
from /usr/include/opencv4/opencv2/core/core_c.h:48,
from /usr/include/opencv4/opencv2/highgui/highgui_c.h:45,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet/src/box.h:3,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet/src/image.h:9,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet_ros/include/darknet_ros/image_interface.h:12,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet_ros/src/image_interface.c:9:
/usr/include/opencv4/opencv2/core/cvdef.h:690:4: error: #error "OpenCV 4.x+ requires enabled C++11 support"
# error "OpenCV 4.x+ requires enabled C++11 support"
^~~~~
In file included from /usr/include/opencv4/opencv2/core/types_c.h:82:0,
from /usr/include/opencv4/opencv2/core/core_c.h:48,
from /usr/include/opencv4/opencv2/highgui/highgui_c.h:45,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet/src/box.h:3,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet/src/image.h:9,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet/src/avgpool_layer.h:4,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet/src/avgpool_layer.c:1:
/usr/include/opencv4/opencv2/core/cvdef.h:690:4: error: #error "OpenCV 4.x+ requires enabled C++11 support"
# error "OpenCV 4.x+ requires enabled C++11 support"
^~~~~
compilation terminated due to -Wfatal-errors.
compilation terminated due to -Wfatal-errors.
In file included from /usr/include/opencv4/opencv2/core/types_c.h:82:0,
from /usr/include/opencv4/opencv2/core/core_c.h:48,
from /usr/include/opencv4/opencv2/highgui/highgui_c.h:45,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
from /home/nvidiaagx/catkin_ws/src/darknet_ros/darknet/src/activations ...
i think the way to add c++11 at compile time is adding the following line adt CmakeLists.txt
Hey, I tried adding that line to the top of the CmakeLists.txt, but I'm getting the same error with some extra warnings :
Seems like for some reason Cmake is only reading C. Could you show us your file?
@tdam2112 were you able to find a solution to it?