报错如图
原因是在编写CMakeLists.txt时没有正确连接opencv的lib
CMakeLists.txt应该这样编写
cmake_minimum_required(VERSION 2.8)
project(imgDemo)
set(CMAKE_BUILD_TYPE “Debug”)
#查找opencv路径
find_package(OpenCV REQUIRED)
#添加opencv头文件
include_directories(KaTeX parse error: Expected 'EOF', got '#' at position 24: …INCLIDE_DIRS})
#̲打印opencvlib的绝对路…{OpenCV_INCLUDE_DIRS})
add_executable(main readPomeloOnTree.cpp )
target_link_libraries(main ${OpenCV_LIBS})