Hello,
After OpenCV installation using this shell script, I’m facing problems when I try to run some a simple example c++ OpenCV code, although a python simple example works.
It’s a simple “imread–>imshow” code, nothing complicated. The problem appears to be a header file problem.
Here is the error message I’m getting.
anjulo@imac:~$ make cpp
g++ cpp.cpp -o cpp `pkg-config opencv --cflags --libs`
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
cpp.cpp:1:10: fatal error: opencv2/core.hpp: No such file or directory
1 | #include <opencv2/core.hpp>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:4: cpp] Error 1
I have found after some searching the command pkg-config opencv --cflags --libs
should tell me where the headers or libs are. But it’s giving me part of the error above.
anjulo@imac:~$ pkg-config --libs opencv
Package opencv4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
I would appreciate any help to solve this problem.
I’m running on Ubuntu 20.04