cmake编译出错:No CMAKE_CXX_COMPILER could be found.

温馨提示:文章已超过1767天没有更新,可能存在链接失效,相关教程仅供参考

在ubuntu系统上运行cmake编译时出错报错命令如下

-- The cxx compiler identification is unknown
CMake Error at CMakeLists.txt:12 (project) :
    No CMAKE_CXX_COMPILER could be found.
Tell CNake where to find the compiler by setting either the environment
variable "Cxx" or the CNake cache entry'CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete,errors occurred !

image.png

解决办法

sudo apt install -y build-essential

build-essential有什么作用

Ubuntu缺省情况下,并没有提供C/C++的编译环境,因此还需要手动安装。但是如果单独安装gcc以及g++比较麻烦,所以Ubuntu提供了一个build-essential软件包,他集成了gcc以及g++所需要的环境

© 除非注明,否则均为阿豪运维笔记原创文章,转载或复制请以超链接形式并注明出处

取消
微信二维码
微信二维码
支付宝二维码