In opencv4 while compiling code, I am getting this error:
fatal error: opencv2/core.hpp: No such file or directory
compilation terminated.
I properly installed opencv4. Why am I getting an error?
Try installing the -dev or -devel package for OpenCV2 to get the header file.
sudo apt-get install libopencv-core-dev on Debian and Ubuntu, and sudo yum install opencv-devel on Fedora.
Once that's done, append $(pkg-config --cflags opencv) to your compiler command:
export CC="gcc $(pkg-config --cflags opencv)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With