修改cmakelist文件改为如下:

cmake_minimum_required(VERSION 3.17)
project(untitled)

set(CMAKE_CXX_STANDARD 14)
find_package( OpenCV REQUIRED )

include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(untitled main.cpp)
target_link_libraries(untitled ${OpenCV_LIBS} )