1
votes

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.

3
Add command that you are using to compile codeAlex

3 Answers

2
votes

You need to add the following flag to compiler command:

-I<here_path_to_opencv_headers_root>
1
votes

Are you finish the installation of OpenCV ? Normaly if the command "sudo make install" are passed the headers are in the include path If you dont't install OpenCV on your system then add -Ihost/opencv/build/include/ at the command line of make . But the same problem will arise with lib when you have set th includes. The best solution is to follow the indication of http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html and https://help.ubuntu.com/community/OpenCV

0
votes

You can also use a tool called pkg-config to find the location of the header files and libraries you need, like so

 pkg-config --libs --cflags opencv

And you can include these in your compiler flags or build scripts with

 clang++  $(pkg-config --libs --cflags opencv)  -o main.cpp binary.app