1

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.

1
  • Add command that you are using to compile code Commented Oct 16, 2013 at 7:55

3 Answers 3

2

You need to add the following flag to compiler command:

-I<here_path_to_opencv_headers_root>
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.