# CMake Error: No CMAKE_CXX_COMPILER could be found

**Code:** `No CMAKE_CXX_COMPILER could be found` · **Category:** C/C++ · **Seen on:** CMake, Linux

CMake cannot find a C++ compiler.

## Meaning

During project() CMake tries to compile a tiny test program. If it cannot find `c++`, `g++` or `clang++`, it stops with this message and writes details to `CMakeFiles/CMakeError.log`.

## Common causes

- No compiler installed
- Compiler not in PATH
- Wrong generator
- Only a runtime, not the build tools, installed in a minimal Docker image
- Compiler installed but not in PATH

## Quick fix

1. Install g++/clang
2. Set `CXX`
3. Install `build-essential` (Debian) or Xcode command line tools (macOS)
4. Read `CMakeFiles/CMakeError.log` for the exact failure

## Detailed fix by platform

### Ubuntu

1. `sudo apt install build-essential cmake`

## How to diagnose

1. **PATH** — g++ present?
2. **Recent change** — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cpp/cmake-no-cxx-compiler)
