1

Note: this is in the context of installing cafe.

At the moment I have openCV installed at:

/home/myName/Documents/my folder/opencv/  

However C++ can't find it here, as demonstrated by the fact that any mention of:

#include <opencv2/opencv.hpp>

In any C++ source code, results in:

fatal error: opencv2/opencv.hpp: No such file or directory

I tried to solve this by using the following .pc file:

prefix="/home/myName/Documents/my folder/opencv/"
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib

Name: openCV
Description: The openCV library
Version: 3.1.0
Cflags: -I${includedir}/openCV
Libs: -L${libdir} -lopenCV

And putting it in:

/usr/lib/pkgconfig

However this had no effect. I also tried modifying the make file of cafe like this:

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include \
                                    /usr/include/hdf5/serial/ \
                                    "/home/myName/Documents/my folder/opencv/include"
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib \
                                "/home/myName/Documents/my folder/opencv/lib"

This also didn't work. At the moment I am out of ideas. Does anyone know how I can tell C++ where to find openCV?

4
  • Where actually is opencv.hpp? Based on what you have written above, I would have expected it to be /home/myName/Documents/my folder/opencv/include/opencv2 - in which case the additional /openCV on your Cflags path is superfluous. – steeldriver Dec 15 '16 at 19:45
  • 1
    Get rid of the space in "my folder" unless you love spending your time figuring out how may layers of quoting are necessary to just make things work. – ubfan1 Dec 15 '16 at 19:48
  • @steeldriver: that is indeed the folder, I removed the extra /openCV, but the error remains. – dimpol Dec 15 '16 at 19:53
  • @ubfan1: removing the space now would probably also cause various problems with the installed files having the wrong paths created. Installing this took about 4 hours, so I'd like to avoid reinstalling. – dimpol Dec 15 '16 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.