CMake Error: No CMAKE_CXX_COMPILER could be found
CMake cannot find a C++ compiler.
No CMAKE_CXX_COMPILER could be foundCMAKE_C_COMPILER not found 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
- Install g++/clang
- Set
CXX - Install
build-essential(Debian) or Xcode command line tools (macOS) - Read
CMakeFiles/CMakeError.logfor the exact failure
Detailed fix by platform
Ubuntu
sudo apt install build-essential cmake
How to diagnose
- PATH — g++ present?
- Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 'this' was not captured C++: error: 'this' was not captured for this lambda function
- C compiler cannot create executables configure: error: C compiler cannot create executables / no acceptable C compiler found in $PATH
- cannot be implicitly captured Clang: error: variable 'x' cannot be implicitly captured in a lambda with no capture-default specified
Most viewed in C/C++
- AddressSanitizer: heap-use-after-free C/C++: ==ERROR: AddressSanitizer: heap-use-after-free on address — memory used after delete/free
- AddressSanitizer: heap-buffer-overflow C/C++: ==ERROR: AddressSanitizer: heap-buffer-overflow on address — READ/WRITE of size N
- Bus error C/C++: Bus error (core dumped) — SIGBUS from misaligned access or a bad memory-mapped file
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 28 Nov 2026