M HYPE SPLASH
// general

How do I tell c++ where opencv2/opencv.hpp is?

By John Campbell

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 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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