Using local version of OpenCV and exclude the system one

asked 2017-03-14 06:27:33 -0600

lovaj gravatar image

I have installed a library (OpenCV) in ~/local on a remote machine, since I don't have sudo access there. Notice that an older version of the same library is installed in /usr/local.

I'm trying to compile this code:

g++ -DCC_DISABLE_CUDA -I/home/spm1428/CloudCache -I/home/spm1428/local/include/opencv -I/home/spm1428/local/include/opencv2 -I/usr/include/boost -I/home/spm1428/vlfeat -O3 -g -Wall -c -fopenmp -std=c++11 -c -o Descriptor.o ../Descriptors/Descriptor.cpp

However, the returned error is:

In file included from /usr/local/include/opencv2/opencv.hpp:77:0,
                 from /home/spm1428/CloudCache/Utilities/Utility.hpp:11,
                 from ../Descriptors/Descriptor.cpp:17:
/usr/local/include/opencv2/highgui/highgui.hpp:165:25: error: redeclaration of ‘IMREAD_UNCHANGED’
     IMREAD_UNCHANGED  =-1,
                         ^
In file included from ../Descriptors/Descriptor.cpp:13:0:
/home/spm1428/local/include/opencv2/imgcodecs.hpp:65:8: note: previous declaration ‘cv::ImreadModes IMREAD_UNCHANGED’
        IMREAD_UNCHANGED            = -1, //!< If set, return the loaded image as is (with alpha channel,
        ^
In file included from /usr/local/include/opencv2/opencv.hpp:77:0,
                 from /home/spm1428/CloudCache/Utilities/Utility.hpp:11,
                 from ../Descriptors/Descriptor.cpp:17:
/usr/local/include/opencv2/highgui/highgui.hpp:167:24: error: redeclaration of ‘IMREAD_GRAYSCALE’
     IMREAD_GRAYSCALE  =0,

I think that this happens because there is another version installed. How can I solve this?

I think this error happens for the same reason (the old version doesn't have cv::xfeatures2d::SURF).

edit retag flag offensive close merge delete