Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your line

#include "../opencv2/opencv.hpp"

is specifying a relative path for #include to look. If it can't find it there, then it tries to look for it wherever it stores the standard header files (such as: iostream, stdio.h). Assuming you built OpenCV for linux properly, the headers get copied into /usr/include/. You'll likely find the opencv.hpp at "/usr/include/opencv2/opencv.hpp". The line isn't working because of the ".." you added to it. It's causing it to look for a file at /usr/opencv2/opencv.hpp".

You can probably fix this by just replacing that line with this:

#include <opencv2/opencv.hpp>

That said, it would be better practice to pull in only headers that are needed, such as:

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>

Your line

#include "../opencv2/opencv.hpp"

is specifying a relative path for #include to look. If it can't find it there, then it tries to look for it wherever it stores the standard header files (such as: iostream, stdio.h). Assuming you built OpenCV for linux properly, the headers get copied into /usr/include/. You'll likely find the opencv.hpp at "/usr/include/opencv2/opencv.hpp". The line isn't working because of the ".." you added to it. It's causing it to look for a file at /usr/opencv2/opencv.hpp".

You can probably fix this by just replacing that line with this:

#include <opencv2/opencv.hpp>

That said, it would be better practice to pull in only headers that are needed, such as:

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>