Clion configuration opencv
Clion configuration opencv
This article mainly configures the compiled opencv, which mainly includes the following contents
1 install clion
Students can apply for an educational version of clion on clion to facilitate the use of all JetBrains products. For the educational version application link, refer to
the official website download link , and finally choose the path of your own installation, and you can go to the next step in the whole process.
2 configure mingw
Official website link: https://osdn.net/projects/mingw/
Configure environment variables
to test mingw
through the command `gcc -v to test
gcc -v
3opencv download and configuration
Here is the direct download of the opencv package, which can be used directly through the environment configuration, avoiding the manual compilation process, and the user only needs to configure the environment variables.
The download link of opencv on github
Configure the address corresponding to the above figure to the environment variable to
configure the environment variable
4clion+opencv test
Just use clion to automatically detect gcc.
Writing cmakelist
cmake_minimum_required(VERSION 3.23)
project(detect)
set(CMAKE_CXX_STANDARD 14)
set(OpenCV_DIR E:\\cppTools\\opencv\\opencv\\x64\\mingw\\lib)
find_package(OpenCV REQUIRED)
#include_directories(E:\\cppTools\\opencv\\opencv\\x64)
add_executable(detect main.cpp)
target_link_libraries(detect ${
OpenCV_LIBS})
The detect here represents the corresponding project name
. Note that if no environment variable is configured, then #include_directories needs to be executed with the comment released.
Test code
There are deficiencies in this blog, please criticize and correct