# #include <opencv2/opencv.hpp> (and others) don't work

I have installed OpenCV on my Linux computer using this tutorial: https://docs.opencv.org/master/d7/d9f... The installation process went without problems, but now I cant use the libraries in my CLion project. I have edited the following lines to my CMakeLists.txt as described in various tutorials:

cmake_minimum_required(VERSION 3.15)
project(OCRsrc)

set(CMAKE_CXX_STANDARD 14)

find_package(OpenCV REQUIRED)

include_directories($(OpenCV_INCLUDE_DIRS)) target_link_libraries(OCRsrc$(OpenCV_LIBS))


after make the following error appears:

fatal error: opencv2/opencv.hpp:
No such file or directory
#include <opencv2/opencv.hpp>


if I change the line to #include<opencv4/opencv2/opencv.hpp> the include works, but the build still fails, as the files included in this header cant be located. Did something go wrong with the folder structure when I installed the library? The headers I would want to include are in /usr/local/include/opencv4/opencv2/

The variable OpenCV_INCLUDE_DIRS gets set to /usr/local/include/opencv4

edit retag close merge delete