C++ – Including OpenCv header files in Ubuntu

cheader-filesopencvUbuntu

I first included the highgui.hpp file as

#include "opencv2/highgui/highgui.hpp"

This gave the error " No such file or directory".

When I replaced this with

#include "/host/opencv/build/include/opencv2/highgui/highgui.hpp"

This error was solved. But I got another error,

In file included from opencvtest.cpp:1:0:
/host/opencv/build/include/opencv2/highgui/highgui.hpp:46:33: fatal error: opencv2/core/core.hpp: No such file or directory

This means that now the core.hpp file included in highgui.hpp cant be located.

I need a way so that it can automatically look for included files in the "include" folder. How to do this in ubuntu??
I have used Microsoft Visual Studio previously, where this folder is added in project properties, in additional libraries.

Best Answer

You need to add the following flag to compiler command:

-I<here_path_to_opencv_headers_root>
Related Topic