1

Disclamer: using -nostdcincl isn't possible because it excludes needed system libraries. Here instead the problem seems to be that tthe compiler ignores my -I directives

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).

Community
  • 1
  • 1
justHelloWorld
  • 6,478
  • 8
  • 58
  • 138
  • See http://stackoverflow.com/questions/4980819/what-are-the-gcc-default-include-directories _why_ /usr/local is included. No solutions there, though. – MSalters Mar 15 '17 at 08:41
  • Possible duplicate of [gcc: How to ignore standard include paths?](http://stackoverflow.com/questions/2988779/gcc-how-to-ignore-standard-include-paths) – MSalters Mar 15 '17 at 08:42

0 Answers0