pjreddie / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
25.88k stars 21.33k forks source link

Error: OpenCV 4.x requires enabled C++11 support #2119

Open adbidwai opened 4 years ago

adbidwai commented 4 years ago

I want to use darknet_ros along with other packages like rotorS and velodyne. But the issue is darknet_ros works perfectly when I build it in a separate package and gets built. But when I try to build it along with the packages I want to use it with the following error pops up while building using catkin build. To give more info I have installed OpenCV using CUDA with CUDNN support from the instrcutions given in the following link: https://gist.github.com/raulqf/f42c718a658cddc16f9df07ecc627be7 My operating system: Ubuntu 18.04 ROS distributuion: ROS Melodic


In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/box.h:3,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/image.h:9,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/avgpool_layer.h:4,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/avgpool_layer.c:1:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/box.h:3,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/image.h:9,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet_ros/include/darknet_ros/image_interface.h:12,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet_ros/src/image_interface.c:9:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/activations.h:3,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/activation_layer.h:4,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/activation_layer.c:1:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/box.h:3,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/image.h:9,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/image.c:1:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/avgpool_layer.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/src/image_interface.c.o] Error 1
In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/activations.h:3,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/activations.c:1:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/cuda.h:4,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/local_layer.h:4,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/local_layer.c:1:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/activation_layer.c.o] Error 1
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/image.c.o] Error 1
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/activations.c.o] Error 1
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/local_layer.c.o] Error 1
In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/blas.h:3,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/blas.c:1:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/blas.c.o] Error 1
In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/list.h:3,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/list.c:3:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/layer.h:1,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/layer.c:1:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/list.c.o] Error 1
In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/cuda.h:4,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/convolutional_layer.h:4,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/batchnorm_layer.c:1:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/layer.c.o] Error 1
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/batchnorm_layer.c.o] Error 1
In file included from /usr/local/include/opencv4/opencv2/core/types_c.h:84:0,
                 from /usr/local/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui_c.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/include/darknet.h:25,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/box.h:3,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/box.c:1:
/usr/local/include/opencv4/opencv2/core/cvdef.h:704: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.
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/home/adbidwai/catkin_ws/src/darknet_ros/darknet/src/box.c.o] Error 1
/home/adbidwai/catkin_ws/src/darknet_ros/darknet_ros/src/YoloObjectDetector.cpp: In member function ‘darknet_ros::IplImageWithHeader_ darknet_ros::YoloObjectDetector::getIplImageWithHeader()’:
/home/adbidwai/catkin_ws/src/darknet_ros/darknet_ros/src/YoloObjectDetector.cpp:565:49: error: no matching function for call to ‘_IplImage::_IplImage(cv::Mat&)’
   IplImage* ROS_img = new IplImage(camImageCopy_);
                                                 ^
In file included from /usr/local/include/opencv4/opencv2/core/core_c.h:48:0,
                 from /usr/local/include/opencv4/opencv2/imgproc/types_c.h:46,
                 from /opt/ros/melodic/include/cv_bridge/cv_bridge.h:45,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet_ros/include/darknet_ros/YoloObjectDetector.hpp:33,
                 from /home/adbidwai/catkin_ws/src/darknet_ros/darknet_ros/src/YoloObjectDetector.cpp:10:
/usr/local/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: _IplImage::_IplImage()
 _IplImage
 ^~~~~~~~~
/usr/local/include/opencv4/opencv2/core/types_c.h:327:1: note:   candidate expects 0 arguments, 1 provided
/usr/local/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: constexpr _IplImage::_IplImage(const _IplImage&)
/usr/local/include/opencv4/opencv2/core/types_c.h:327:1: note:   no known conversion for argument 1 from ‘cv::Mat’ to ‘const _IplImage&’
/usr/local/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: constexpr _IplImage::_IplImage(_IplImage&&)
/usr/local/include/opencv4/opencv2/core/types_c.h:327:1: note:   no known conversion for argument 1 from ‘cv::Mat’ to ‘_IplImage&&’
make[2]: *** [CMakeFiles/darknet_ros_lib.dir/src/YoloObjectDetector.cpp.o] Error 1
make[1]: *** [CMakeFiles/darknet_ros_lib.dir/all] Error 2
make: *** [all] Error 2
cd /home/adbidwai/catkin_ws/build/darknet_ros; catkin build --get-env darknet_ros | catkin env -si  /usr/bin/make --jobserver-fds=6,7 -j; cd -
....................................................................................................
Failed     << darknet_ros:make                [ Exited with code 2 ]                                
Failed    <<< darknet_ros                     [ 5.1 seconds ]`````
InduGirish commented 4 years ago

If you have solved this issue, please provide the solution. Thanks

adbidwai commented 4 years ago

This issue hasnt been solved yet :(

Song-Jingyu commented 4 years ago

This issue hasnt been solved yet :( May I have your help on solving this problem? I encountered the same problem and I really want to know your solution!