当前位置: 首页 > news >正文

ubuntu中使用cmake编译报错No CMAKE_CXX_COMPILER could be found.的解决方法

ubuntu中使用cmake编译报错No CMAKE_CXX_COMPILER could be found.的解决方法

  • No CMAKE_CXX_COMPILER could be found.
  • Could NOT find CUDA (missing: CUDA_NVCC_EXECUTABLE CUDA_CUDART_LIBRARY)
  • Could not find a package configuration file provided by "OpenCV" with any

No CMAKE_CXX_COMPILER could be found.

ubuntu编译的时候出现以下报错:

CMake Error at CMakeLists.txt:3 (project):No CMAKE_CXX_COMPILER could be found.Tell CMake where to find the compiler by setting either the environmentvariable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full pathto the compiler, or to the compiler name if it is in the PATH.

解决办法如下:

  1. 确保安装了C++编译器:
  • 对于 Windows,你可能需要安装 Visual Studio,并确保选择了 Desktop development with C++ 选项,这样才能安装C++编译器(如 cl.exe)。
  • 对于 Linux 和 macOS,你需要安装 g++ 或者 clang:
    Ubuntu: 你可以通过以下命令安装:
	sudo apt updatesudo apt install build-essential

安装过程
在这里插入图片描述
重新编译,成功。报cuda错误
在这里插入图片描述

Could NOT find CUDA (missing: CUDA_NVCC_EXECUTABLE CUDA_CUDART_LIBRARY)

  1. 检查环境变量, ls /usr/local/cuda/bin,如果已安装,运行下面的代码,否则会提示没路径
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

然后运行 source ~/.bashrc 使配置生效。再试运行 nvcc --version。

  1. 否则安装CUDA开发包在这里插入代码片
sudo apt-get install nvidia-cuda-toolkit

在这里插入图片描述

Could not find a package configuration file provided by “OpenCV” with any

cmake出现以下报错

CMake Warning at CMakeLists.txt:28 (find_package):By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project hasasked CMake to find a package configuration file provided by "OpenCV", butCMake did not find one.Could not find a package configuration file provided by "OpenCV" with anyof the following names:OpenCVConfig.cmakeopencv-config.cmakeAdd the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set"OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"provides a separate development package or SDK, be sure it has beeninstalled.

输入这个指令

sudo apt-get install libopencv-dev python3-opencv

在这里插入图片描述


http://www.mrgr.cn/news/51902.html

相关文章:

  • Scala入门基础(11)类的继承
  • CSDN怎么发布收费文章
  • Android SELinux——调试工具audio2allow介绍(十三)
  • 上海亚商投顾:沪指冲高回落 成渝板块近50股涨停
  • [网络基础]——什么是IP路由,路由优先级,度量值详解
  • iOS应用审核:开发者网站App信息填写指南
  • Moveit更换默认规划器KDL
  • web API基础
  • 【Linux】从零开始手搓 Shell (超详解)
  • 机器学习实践
  • 代码签名证书怎么申请?
  • 极化基变化后的散射矩阵
  • 我和双指针的初次亲密邂逅:那一刻心跳加速
  • pikachu靶场CSRF-post测试报告
  • leetcode中常用的enumerate用法和常用场景
  • 基于Python的自然语言处理系列(35):Transformer 模型的微调(Finetuning)
  • 3-6 AUTOSAR RTE数据一致性管理
  • Corgi Raytracing - Built-in RP Forward Deferred URP VR SPI supported 光线追踪
  • spark:Structured Streaming介绍
  • 基于ST VIPERGAN50的50W 反激隔离型智能风冷无霜冰箱电源解决方案