Ask Your Question

Revision history [back]

Tutorial "DisplayImage.cpp" didn't work for me

Hi there,

I am following this: https://docs.opencv.org/4.0.0-rc/d7/d9f/tutorial_linux_install.html

    cmake .
-- [Deps] Use OpenCV 4.0.0 for image loading
-- Configuring done
-- Generating done
-- Build files have been written to: /home/paperspace/opencv-test

I ran make & got a list of errors:

In file included from /usr/include/c++/5/algorithm:61:0,
                 from /usr/local/include/opencv4/opencv2/core/base.hpp:55,
                 from /usr/local/include/opencv4/opencv2/core.hpp:54,
                 from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
                 from /home/paperspace/opencv-test/DisplayImage.cpp:2:
/usr/include/c++/5/bits/stl_algobase.h:340:18: note: synthesized method ‘cv::KeyPoint& cv::KeyPoint::operator=(const cv::KeyPoint&)’ first required here
        *__result = *__first;
                  ^
/usr/include/c++/5/bits/stl_algobase.h: In instantiation of ‘static _BI2 std::__copy_move_backward<false, false, std::random_access_iterator_tag>::__copy_move_b(_BI1, _BI1, _BI2) [with _BI1 = cv::Rect_<int>*; _BI2 = cv::Rect_<int>*]’:
/usr/include/c++/5/bits/stl_algobase.h:604:58:   required from ‘_BI2 std::__copy_move_backward_a(_BI1, _BI1, _BI2) [with bool _IsMove = false; _BI1 = cv::Rect_<int>*; _BI2 = cv::Rect_<int>*]’
/usr/include/c++/5/bits/stl_algobase.h:614:5:   required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = false; _BI1 = cv::Rect_<int>*; _BI2 = cv::Rect_<int>*]’
/usr/include/c++/5/bits/stl_algobase.h:649:8:   required from ‘_BI2 std::copy_backward(_BI1, _BI1, _BI2) [with _BI1 = cv::Rect_<int>*; _BI2 = cv::Rect_<int>*]’
/usr/include/c++/5/bits/vector.tcc:339:4:   required from ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, const _Tp&) [with _Tp = cv::Rect_<int>; _Alloc = std::allocator<cv::Rect_<int> >; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<cv::Rect_<int>*, std::vector<cv::Rect_<int> > >; typename std::_Vector_base<_Tp, _Alloc>::pointer = cv::Rect_<int>*]’
/usr/include/c++/5/bits/stl_vector.h:925:17:   required from ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = cv::Rect_<int>; _Alloc = std::allocator<cv::Rect_<int> >; std::vector<_Tp, _Alloc>::value_type = cv::Rect_<int>]’
/usr/local/include/opencv4/opencv2/objdetect/detection_based_tracker.hpp:193:45:   required from here
/usr/include/c++/5/bits/stl_algobase.h:549:18: error: ambiguous overload for ‘operator=’ (operand types are ‘cv::Rect_<int>’ and ‘cv::Rect_<int>’)
      *--__result = *--__last;
                  ^
In file included from /usr/local/include/opencv4/opencv2/core.hpp:58:0,
                 from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
                 from /home/paperspace/opencv-test/DisplayImage.cpp:2:
/usr/local/include/opencv4/opencv2/core/types.hpp:1852:13: note: candidate: cv::Rect_<_Tp>& cv::Rect_<_Tp>::operator=(const cv::Rect_<_Tp>&) [with _Tp = int]
 Rect_<_Tp>& Rect_<_Tp>::operator = ( const Rect_<_Tp>& r )
             ^
/usr/local/include/opencv4/opencv2/core/types.hpp:1862:13: note: candidate: cv::Rect_<_Tp>& cv::Rect_<_Tp>::operator=(cv::Rect_<_Tp>) [with _Tp = int]
 Rect_<_Tp>& Rect_<_Tp>::operator = ( Rect_<_Tp>&& r ) CV_NOEXCEPT
             ^
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:72: 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

--

Environment info:
OS: Ubuntu 16.04.5 LTS
GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
CMake version: version 3.12.2

Any ideas? Seems like an import issue perhaps?