Ask Your Question

Revision history [back]

OpenCV DisplayImage Example Errors

Hello OpenCV Community,

I have been an OpenCV python user for a while, but I just started to use OpenCV C++ recently. I installed and tested OpenCV 4.0 following the protocols on https://docs.opencv.org/4.0.0/d7/d9f/tutorial_linux_install.html. The program passed the tests after installation and it seems that the installation was successful.

``` [----------] Global test environment tear-down [==========] 10797 tests from 228 test cases ran. (385130 ms total) [ PASSED ] 10797 tests.

YOU HAVE 10 DISABLED TESTS ```

However, when I started to do the DisplayImage example on https://docs.opencv.org/4.0.0/db/df5/tutorial_linux_gcc_cmake.html, I got errors.

The "DisplayImage.cpp" is exactly the same to the one in the tutorial. My "CMakeLists.txt file" is this:

cmake_minimum_required(VERSION 2.8) project( DisplayImage ) find_package( OpenCV REQUIRED ) include_directories( /usr/local/include/opencv4/ ) add_executable( DisplayImage DisplayImage.cpp ) target_link_libraries( DisplayImage /usr/local/lib )

The last few lines of the error is like this:

CMakeFiles/DisplayImage.dir/build.make:62: recipe for target 'CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o' failed make[2]: *** [CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

Please provide some suggestions. Thank you very much.

click to hide/show revision 2
None

updated 2018-12-15 10:16:19 -0600

berak gravatar image

OpenCV DisplayImage Example Errors

Hello OpenCV Community,

I have been an OpenCV python user for a while, but I just started to use OpenCV C++ recently. I installed and tested OpenCV 4.0 following the protocols on https://docs.opencv.org/4.0.0/d7/d9f/tutorial_linux_install.html. The program passed the tests after installation and it seems that the installation was successful.

```

[----------] Global test environment tear-down
[==========] 10797 tests from 228 test cases ran. (385130 ms total)
[  PASSED  ] 10797 tests.

tests. YOU HAVE 10 DISABLED TESTS ```

However, when I started to do the DisplayImage example on https://docs.opencv.org/4.0.0/db/df5/tutorial_linux_gcc_cmake.html, I got errors.

The "DisplayImage.cpp" is exactly the same to the one in the tutorial. My "CMakeLists.txt file" is this:

 cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
include_directories( /usr/local/include/opencv4/ )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage /usr/local/lib )

The last few lines of the error is like this:

 CMakeFiles/DisplayImage.dir/build.make:62: recipe for target 'CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o' failed
make[2]: *** [CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Please provide some suggestions. Thank you very much.

OpenCV DisplayImage Example Errors

Hello OpenCV Community,

I have been an OpenCV python user for a while, but I just started to use OpenCV C++ recently. I installed and tested OpenCV 4.0 following the protocols on https://docs.opencv.org/4.0.0/d7/d9f/tutorial_linux_install.html. The program passed the tests after installation and it seems that the installation was successful.

[----------] Global test environment tear-down
[==========] 10797 tests from 228 test cases ran. (385130 ms total)
[  PASSED  ] 10797 tests.

  YOU HAVE 10 DISABLED TESTS

However, when I started to do the DisplayImage example on https://docs.opencv.org/4.0.0/db/df5/tutorial_linux_gcc_cmake.html, I got errors.

The "DisplayImage.cpp" is exactly the same to the one in the tutorial. My "CMakeLists.txt file" is this:

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
include_directories( /usr/local/include/opencv4/ )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage /usr/local/lib )

The last few lines of the error is like this:

CMakeFiles/DisplayImage.dir/build.make:62: recipe for target 'CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o' failed
make[2]: *** [CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Please provide some suggestions. Thank you very much.

Follow-up ##

I just output the stderror (~5000 lines) to file so I could see all the errors. In the first several lines of the error, it said:

[ 50%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o In file included from /usr/local/include/opencv4/opencv2/core.hpp:52:0, from /usr/local/include/opencv4/opencv2/opencv.hpp:52, from /home/marine/Workspace/OpenCV_4_CPP/project/DisplayImage.cpp:2: /usr/local/include/opencv4/opencv2/core/cvdef.h:654:4: error: #error "OpenCV 4.x+ requires enabled C++11 support" # error "OpenCV 4.x+ requires enabled C++11 support" ^

It seems that I don't have C++ 11 support.

OpenCV DisplayImage Example Errors

Hello OpenCV Community,

I have been an OpenCV python user for a while, but I just started to use OpenCV C++ recently. I installed and tested OpenCV 4.0 following the protocols on https://docs.opencv.org/4.0.0/d7/d9f/tutorial_linux_install.html. The program passed the tests after installation and it seems that the installation was successful.

[----------] Global test environment tear-down
[==========] 10797 tests from 228 test cases ran. (385130 ms total)
[  PASSED  ] 10797 tests.

  YOU HAVE 10 DISABLED TESTS

However, when I started to do the DisplayImage example on https://docs.opencv.org/4.0.0/db/df5/tutorial_linux_gcc_cmake.html, I got errors.

The "DisplayImage.cpp" is exactly the same to the one in the tutorial. My "CMakeLists.txt file" is this:

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
include_directories( /usr/local/include/opencv4/ )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage /usr/local/lib )

The last few lines of the error is like this:

CMakeFiles/DisplayImage.dir/build.make:62: recipe for target 'CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o' failed
make[2]: *** [CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Please provide some suggestions. Thank you very much.

Follow-up ##

Follow-up

I just output the stderror (~5000 lines) to file so I could see all the errors. In the first several lines of the error, it said:

[ 50%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o In file included from /usr/local/include/opencv4/opencv2/core.hpp:52:0, from /usr/local/include/opencv4/opencv2/opencv.hpp:52, from /home/marine/Workspace/OpenCV_4_CPP/project/DisplayImage.cpp:2: /usr/local/include/opencv4/opencv2/core/cvdef.h:654:4: error: #error "OpenCV 4.x+ requires enabled C++11 support" # error "OpenCV 4.x+ requires enabled C++11 support" ^

It seems that I don't have C++ 11 support.

OpenCV DisplayImage Example Errors

Hello OpenCV Community,

I have been an OpenCV python user for a while, but I just started to use OpenCV C++ recently. I installed and tested OpenCV 4.0 following the protocols on https://docs.opencv.org/4.0.0/d7/d9f/tutorial_linux_install.html. The program passed the tests after installation and it seems that the installation was successful.

[----------] Global test environment tear-down
[==========] 10797 tests from 228 test cases ran. (385130 ms total)
[  PASSED  ] 10797 tests.

  YOU HAVE 10 DISABLED TESTS

However, when I started to do the DisplayImage example on https://docs.opencv.org/4.0.0/db/df5/tutorial_linux_gcc_cmake.html, I got errors.

The "DisplayImage.cpp" is exactly the same to the one in the tutorial. My "CMakeLists.txt file" is this:

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
include_directories( /usr/local/include/opencv4/ )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage /usr/local/lib )

The last few lines of the error is like this:

CMakeFiles/DisplayImage.dir/build.make:62: recipe for target 'CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o' failed
make[2]: *** [CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Please provide some suggestions. Thank you very much.

Follow-up

I just output the stderror (~5000 lines) to file so I could see all the errors. In the first several lines of the error, it said:

[ 50%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o In file included from /usr/local/include/opencv4/opencv2/core.hpp:52:0, from /usr/local/include/opencv4/opencv2/opencv.hpp:52, from /home/marine/Workspace/OpenCV_4_CPP/project/DisplayImage.cpp:2: /usr/local/include/opencv4/opencv2/core/cvdef.h:654:4: error: #error "OpenCV 4.x+ requires enabled C++11 support" # error "OpenCV 4.x+ requires enabled C++11 support" ^

It seems that I don't have C++ 11 support.

OpenCV DisplayImage Example Errors

Hello OpenCV Community,

I have been an OpenCV python user for a while, but I just started to use OpenCV C++ recently. I installed and tested OpenCV 4.0 following the protocols on https://docs.opencv.org/4.0.0/d7/d9f/tutorial_linux_install.html. The program passed the tests after installation and it seems that the installation was successful.

[----------] Global test environment tear-down
[==========] 10797 tests from 228 test cases ran. (385130 ms total)
[  PASSED  ] 10797 tests.

  YOU HAVE 10 DISABLED TESTS

However, when I started to do the DisplayImage example on https://docs.opencv.org/4.0.0/db/df5/tutorial_linux_gcc_cmake.html, I got errors.

The "DisplayImage.cpp" is exactly the same to the one in the tutorial. My "CMakeLists.txt file" is this:

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
include_directories( /usr/local/include/opencv4/ )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage /usr/local/lib )

The last few lines of the error is like this:

CMakeFiles/DisplayImage.dir/build.make:62: recipe for target 'CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o' failed
make[2]: *** [CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Please provide some suggestions. Thank you very much.

Follow-up

I just output the stderror (~5000 lines) to file so I could see all the errors. In the first several lines of the error, it said:

[ 50%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o In file included from /usr/local/include/opencv4/opencv2/core.hpp:52:0, from /usr/local/include/opencv4/opencv2/opencv.hpp:52, from /home/marine/Workspace/OpenCV_4_CPP/project/DisplayImage.cpp:2: /usr/local/include/opencv4/opencv2/core/cvdef.h:654: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/c++/5/array:35:0, from /usr/local/include/opencv4/opencv2/core/cvdef.h:659, from /usr/local/include/opencv4/opencv2/core.hpp:52, from /usr/local/include/opencv4/opencv2/opencv.hpp:52, from /home/marine/Workspace/OpenCV_4_CPP/project/DisplayImage.cpp:2: /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support \

It seems that I don't have C++ 11 support.

click to hide/show revision 7
None

updated 2018-12-15 10:26:29 -0600

berak gravatar image

OpenCV DisplayImage Example Errors

Hello OpenCV Community,

I have been an OpenCV python user for a while, but I just started to use OpenCV C++ recently. I installed and tested OpenCV 4.0 following the protocols on https://docs.opencv.org/4.0.0/d7/d9f/tutorial_linux_install.html. The program passed the tests after installation and it seems that the installation was successful.

[----------] Global test environment tear-down
[==========] 10797 tests from 228 test cases ran. (385130 ms total)
[  PASSED  ] 10797 tests.

  YOU HAVE 10 DISABLED TESTS

However, when I started to do the DisplayImage example on https://docs.opencv.org/4.0.0/db/df5/tutorial_linux_gcc_cmake.html, I got errors.

The "DisplayImage.cpp" is exactly the same to the one in the tutorial. My "CMakeLists.txt file" is this:

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
include_directories( /usr/local/include/opencv4/ )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage /usr/local/lib )

The last few lines of the error is like this:

CMakeFiles/DisplayImage.dir/build.make:62: recipe for target 'CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o' failed
make[2]: *** [CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Please provide some suggestions. Thank you very much.

Follow-up

I just output the stderror (~5000 lines) to file so I could see all the errors. In the first several lines of the error, it said:

 [ 50%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o
In file included from /usr/local/include/opencv4/opencv2/core.hpp:52:0,
                 from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
                 from /home/marine/Workspace/OpenCV_4_CPP/project/DisplayImage.cpp:2:
/usr/local/include/opencv4/opencv2/core/cvdef.h:654: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/c++/5/array:35:0,
                 from /usr/local/include/opencv4/opencv2/core/cvdef.h:659,
                 from /usr/local/include/opencv4/opencv2/core.hpp:52,
                 from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
                 from /home/marine/Workspace/OpenCV_4_CPP/project/DisplayImage.cpp:2:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \

It seems that I don't have C++ 11 support.

OpenCV DisplayImage Example Errors

Hello OpenCV Community,

I have been an OpenCV python user for a while, but I just started to use OpenCV C++ recently. I installed and tested OpenCV 4.0 following the protocols on https://docs.opencv.org/4.0.0/d7/d9f/tutorial_linux_install.html. The program passed the tests after installation and it seems that the installation was successful.

[----------] Global test environment tear-down
[==========] 10797 tests from 228 test cases ran. (385130 ms total)
[  PASSED  ] 10797 tests.

  YOU HAVE 10 DISABLED TESTS

However, when I started to do the DisplayImage example on https://docs.opencv.org/4.0.0/db/df5/tutorial_linux_gcc_cmake.html, I got errors.

The "DisplayImage.cpp" is exactly the same to the one in the tutorial. My "CMakeLists.txt file" is this:

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
include_directories( /usr/local/include/opencv4/ )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage /usr/local/lib )

The last few lines of the error is like this:

CMakeFiles/DisplayImage.dir/build.make:62: recipe for target 'CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o' failed
make[2]: *** [CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Please provide some suggestions. Thank you very much.

Follow-up

I just output the stderror (~5000 lines) to file so I could see all the errors. In the first several lines of the error, it said:

[ 50%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o
In file included from /usr/local/include/opencv4/opencv2/core.hpp:52:0,
                 from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
                 from /home/marine/Workspace/OpenCV_4_CPP/project/DisplayImage.cpp:2:
/usr/local/include/opencv4/opencv2/core/cvdef.h:654: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/c++/5/array:35:0,
                 from /usr/local/include/opencv4/opencv2/core/cvdef.h:659,
                 from /usr/local/include/opencv4/opencv2/core.hpp:52,
                 from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
                 from /home/marine/Workspace/OpenCV_4_CPP/project/DisplayImage.cpp:2:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \

It seems that I don't have C++ 11 support.

I added "set (CMAKE_CXX_STANDARD 11)" to "CMakeLists.txt file". It seems that this is helpful. However, I got the following erros.

`` marine@Marine-Dell:~/Workspace/OpenCV_4_CPP/project$ make [ 50%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o [100%] Linking CXX executable DisplayImage CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o: In functionmain': DisplayImage.cpp:(.text+0xa1): undefined reference to cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' DisplayImage.cpp:(.text+0x13f): undefined reference tocv::namedWindow(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, int)' DisplayImage.cpp:(.text+0x1b9): undefined reference to cv::imshow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)' DisplayImage.cpp:(.text+0x1f0): undefined reference tocv::waitKey(int)' CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o: In function cv::Mat::~Mat()': DisplayImage.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference tocv::fastFree(void)' CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o: In function cv::Mat::release()': DisplayImage.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x4b): undefined reference tocv::Mat::deallocate()' CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o: In function cv::Mat::operator=(cv::Mat&&)': DisplayImage.cpp:(.text._ZN2cv3MataSEOS0_[_ZN2cv3MataSEOS0_]+0xe7): undefined reference tocv::fastFree(void)' collect2: error: ld returned 1 exit status CMakeFiles/DisplayImage.dir/build.make:94: recipe for target 'DisplayImage' failed make[2]: * [DisplayImage] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed make[1]: [CMakeFiles/DisplayImage.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: ** [all] Error 2

```