CMake Error at CMakeLists.txt: No CMAKE_CXX_COMPILER could be found.

发布时间 2023-07-25 11:20:43作者: 槑孒

系统环境:Ubuntu 22.04.1

1. 问题发生

-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:4 (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.


-- Configuring incomplete, errors occurred!
See also "/home/echo/Desktop/njord/gdal-3.7.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/echo/Desktop/njord/gdal-3.7.0/build/CMakeFiles/CMakeError.log".

2. 解决方法

执行如下命令,即安装 build-essential

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