Ubuntu开发环境搭建之cmake编译错误

问题描述:

使用cmake命令时发现,cmake --version获取版本成功了

但是编译却找不到。

Ubuntu开发环境搭建之cmake编译错误_第1张图片

cmake ..
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:21 (project):
  No CMAKE_C_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:21 (project):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.
 

解决办法:

执行

sudo apt-get update
sudo apt-get install -y build-essential

成功效果

Ubuntu开发环境搭建之cmake编译错误_第2张图片

 编译成功Ubuntu开发环境搭建之cmake编译错误_第3张图片

你可能感兴趣的:(ubuntu,linux)