Opencv – Error when compiling cv.h: No such file or directory

opencv

When I compile a simple program : hello_world.cpp

**I get the error-
**fatal error: cv.h: No such file or directory
compilation terminated.****

Solutions I found but didn't work:

  1. I checked for cv.h and highgui.h if they are there, and got these results:
    /home/snu/OpenCV-2.4.0/include/opencv/highgui.h
    /usr/lib/perl/5.14.2/CORE/cv.h
    /home/snu/OpenCV-2.4.0/include/opencv/cv.h

  2. I checked if opencv is correctly installed by using
    pkg-config opencv –libs, this is what i got :
    -lopencv_calib3d -lopencv_imgproc -lopencv_contrib -lopencv_legacy -lopencv_core -lopencv_ml -lopencv_features2d -lopencv_objdetect -lopencv_flann -lopencv_video -lopencv_highgui

  3. I made some changes in the header files of hello_world.cpp as-
    #include "opencv2/highgui/highgui.hpp"

Best Answer

You are probably not compiling correctly. Add the opencv-include folder in the compiler settings.

Related Topic