cmake_minimum_required(VERSION 3.15)
project(cvtest)
set(CMAKE_CXX_STANDARD 14)
# 可以将下面的路径单独添加到环境变量OpenCV_DIR
set(OpenCV_DIR "H:\\openCV\\opencv\\mingw-build\\install")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
set(OpenCV_LIBS opencv_core opencv_imgproc opencv_highgui opencv_imgcodecs)
# "C_Test"与你工程的命名相关,注意和原来CMakeList.txt中的声明一致
add_executable(cvtest main.cpp)
target_link_libraries(cvtest ${OpenCV_LIBS})
cmake_minimum_required(VERSION 3.15)
project(cvtest)
set(CMAKE_CXX_STANDARD 14)
# 可以将下面的路径单独添加到环境变量OpenCV_DIR
set(OpenCV_DIR "H:\\openCV\\opencv\\mingw-build\\install")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
set(OpenCV_LIBS opencv_core opencv_imgproc opencv_highgui opencv_imgcodecs)
# "C_Test"与你工程的命名相关,注意和原来CMakeList.txt中的声明一致
add_executable(cvtest main.cpp)
target_link_libraries(cvtest ${OpenCV_LIBS})
单独在路径中点击运行会报以下三个错:
原因是opencv编译好的路径没有加入环境变量
加入后重启便可以正常运行了:
到达世界最高城理塘,太美丽,家人们,还是看看远处的Lenna吧: