cmake is not working in opencv c++ project(cmake 在 opencv c++ 项目中不起作用)
问题描述
我需要你的帮助!我在这个链接中有这个 C++ 代码
[链接] https://github.com/royshil/FoodcamClassifier
而且我两天以来一直在尝试编译它,但我失败了他们说我必须使用 cmake ,我试过GUI 版本,它给了我与 cmake 本身相关的错误.所以我拿了 cpp 和头文件并创建了一个新项目,但我现在有 100 个与 opencv 库相关的错误,我向上帝发誓我确定我的项目中包含文件夹和它的库!不知道怎么回事!
有什么想法吗?
错误如下:
<前>'CMake 错误:无法打开缓存文件进行保存.C:/Program Files/CMake 2.8/bin/CMakeCache.txtCMakeLists.txt:4 (FIND_PACKAGE) 处的 CMake 错误:找不到模块 FindOpenCV.cmake 或包的配置文件开放简历.调整 CMAKE_MODULE_PATH 以找到 FindOpenCV.cmake 或将 OpenCV_DIR 设置为包含 OpenCV 的 CMake 配置文件的目录.该文件将具有以下名称之一:OpenCVConfig.cmakeopencv-config.cmakeOpenCV_DIR-NOTFOUND配置不完整,出现错误!CMake 错误:无法打开缓存文件进行保存.C:/Program Files/CMake 2.8/bin/CMakeCache.txtCMake 错误::系统错误:权限被拒绝CMake 错误::系统错误:权限被拒绝 '您可能需要在 CMakeLists.txt
之前 中添加以下代码段行 FIND_PACKAGE(OpenCV Required)
(在我的情况下):
SET("OpenCV_DIR" "PATH/TO/CMake/build")
在我的安装中它解决了问题,因为提到的文件位于构建文件夹中.
I need your help ! I have this C++ code in this link
[link] https://github.com/royshil/FoodcamClassifier
and I've been trying since two days to compaile it , and I've failed they say that I have to use cmake , I've tried the "GUI version and it gave me errors realted to the cmake itself . so I took the cpp and header files and made a new project but I have now 100 errors related to the opencv library and I swear to god I'm sure of the include folders and the libs of it in my project ! don't know what's the matter with it !
any idea ?
Here's the errors :
'CMake Error: Unable to open cache file for save. C:/Program Files/CMake 2.8/bin/CMakeCache.txt CMake Error at CMakeLists.txt:4 (FIND_PACKAGE): Could not find module FindOpenCV.cmake or a configuration file for package OpenCV. Adjust CMAKE_MODULE_PATH to find FindOpenCV.cmake or set OpenCV_DIR to the directory containing a CMake configuration file for OpenCV. The file will have one of the following names: OpenCVConfig.cmake opencv-config.cmake OpenCV_DIR-NOTFOUND Configuring incomplete, errors occurred! CMake Error: Unable to open cache file for save. C:/Program Files/CMake 2.8/bin/CMakeCache.txt CMake Error: : System Error: Permission denied CMake Error: : System Error: Permission denied '
You're probably gonna have to add the following piece of code in the CMakeLists.txt
before the line FIND_PACKAGE(OpenCV Required)
(in my case):
SET("OpenCV_DIR" "PATH/TO/CMake/build")
In my installation it solved the problem since the mentioned files are located in the build folder.
这篇关于cmake 在 opencv c++ 项目中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:cmake 在 opencv c++ 项目中不起作用
基础教程推荐
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 从 std::cin 读取密码 2021-01-01