赞
踩
OpenCV 找不到或者系统版本不符合当前项目需求,报错如下:
cmake ..
# 输出如下:
CMake Error at example/CMakeLists.txt:2 (find_package):
Could not find a configuration file for package "OpenCV" that is compatible
with requested version "3.0.0".
The following configuration files were considered but not accepted:
/usr/local/lib64/cmake/opencv4/OpenCVConfig.cmake, version: 4.5.1
-- Configuring incomplete, errors occurred!
vim CMakeLists.txt
# 添加如下:指定 你编译安装的 目录
set(OpenCV_DIR /build/opencv-3.4.13/build)
find_package(OpenCV REQUIRED)
cd build/
[root@f31df29c1509 build]# cmake ..
-- Found OpenCV: /build/opencv-3.4.13/build (found version "3.4.13")
-- CMAKE_INSTALL_PREFIX = /usr/local
-- Found OpenCV: /build/opencv-3.4.13/build (found suitable version "3.4.13", minimum required is "3.0.0") found components: core imgcodecs imgproc highgui
-- Found OpenMP_CXX: -fopenmp (found version "3.1")
-- Found OpenMP: TRUE (found version "3.1")
OPENMP FOUND
-- Configuring done
-- Generating done
-- Build files have been written to: /build/ocr/mobile-lpr-master/build
比如:OpenCV_DIR 的路径设置为 安装路径 /usr/local 可能会遇到如下报错
原因是,OpenCV 路径设置不对
vim ../CMakeLists.txt
# 这个 文件中 OpenCV_DIR 的路径要设置正确,才能运行
set(OpenCV_DIR /home/moli/soft/sysOpenCV/opencv/build)
find_package(OpenCV REQUIRED)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。