Using OpenCv with CLion

I solved the problem.

First I deleted all old OpenCV files and installations.

After that I followed this guide to install OpenCV and all required packages.

And now everything is working with this CmakeList.txt:

cmake_minimum_required(VERSION 2.8.4)
project(OpenCVTest)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

find_package( OpenCV REQUIRED )
set(SOURCE_FILES main.cpp)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries( ${PROJECT_NAME} ${OpenCV_LIBS} )

Tags:

C++

Opencv

Clion