fatal error: opencv2/core.hpp: No such file or directory compilation terminated in opencv4

14,288

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)"
Share:
14,288
user
Author by

user

Updated on June 08, 2022

Comments

  • user
    user almost 2 years

    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?