0
votes

I have a cpp project that uses both OpenCV and OpenMP. While compiling the file in the terminal I am getting fatal error that says:

No package 'opencv' found main.cpp:3:39: fatal error: opencv2/imgproc/imgproc.hpp: No such file or directory #include compilation terminated.

I tried to add all path to hpp file but then it wants other headers used in the imgproc.hpp.

This is what i am trying to compile:

g++ main.cpp -fopenmp -o aplication pkg-config --cflags --libs opencv -std=c++11

Sorry if that is a stupid question I am trying to learn. Thanks for any help.

1
No such file or directory #include compilation terminated. This means you did not setup the path to the opencv headers correctly. Is there a opencv2 as a subfolder of one of the paths your compiler is searching for include files? Or perhaps you have the paths setup but did not install opencv correctly?drescherjm
I think the problem is the path because I worked with OpenCV previously and it was fine.alexJJ

1 Answers

0
votes

What opencv version are you using, and where are the headers and libraries installed?

seems that pkg-config cannot find opencv. Try pkg-config --list-all | grep opencv to see if it can find.

If opencv is installed in a customized dir, you should defined an environmental variable PKG_CONFIG_PATH.

You can also post the results of the pkg-config command. It helps to solve your problem.