D
D
deadnice2020-06-21 18:03:38
C++ / C#
deadnice, 2020-06-21 18:03:38

How to connect opencv in Clion windows?

I downloaded opencv from the site (I tried it with version 3.4.3, then 2.4.13), put it in the directory: C: / opencv2 / connected it to cmakelist, but I can’t access the libraries in the code.

CMakeLists.txt
cmake_minimum_required(VERSION 3.3)
project(seamCarving)

set(OpenCV_DIR "C:/opencv2/build")
find_package(OpenCV REQUIRED PATHS "C:/opencv2")

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

set(SOURCE_FILES main.cpp)
add_executable(seamCarving ${SOURCE_FILES})

include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(seamCarving ${OpenCV_LIBS})

Main.cpp part
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>

using namespace cv;

Error while compiling
fatal error: opencv2/core/core.hpp: No such file or directory
 #include <opencv2/core/core.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
mingw32-make.exe[3]: *** [CMakeFiles\seamCarving.dir\build.make:62: CMakeFiles/seamCarving.dir/main.cpp.obj] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:75: CMakeFiles/seamCarving.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:82: CMakeFiles/seamCarving.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: seamCarving] Error 2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Zhilin, 2020-06-22
@deadnice

We configure vcpkg , we prescribe in the CLion settings to set the CMAKE_TOOLCHAIN_FILE parameter for CMake, we add to CMakeLists what vcpkg advises after installing the opencv package.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question