No CMAKE_CXX_COMPILER could be found C/C++ Origin: Application & API OSI layer 7 · Application Last updated 28 Nov 2026

CMake Error: No CMAKE_CXX_COMPILER could be found

CMake cannot find a C++ compiler.

Exact message you may see No CMAKE_CXX_COMPILER could be foundCMAKE_C_COMPILER not found
Seen on: CMake Linux

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.

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

'this' was not captured — C++: error: 'this' was not captured for this lambda function (C/C++)'this' was not captur…C compiler cannot create executables — configure: error: C compiler cannot create executables / no acceptable C compiler found in $PATH (C/C++)C compiler cannot cre…cannot be implicitly captured — Clang: error: variable 'x' cannot be implicitly captured in a lambda with no capture-default specified (C/C++)cannot be implicitly …cannot bind non-const lvalue reference — C++: error: cannot bind non-const lvalue reference of type 'T&' to an rvalue of type 'T' (C/C++)cannot bind non-const…case label does not reduce to an integer constant — C/C++: error: case label does not reduce to an integer constant (C/C++)case label does not r…CMake Error: CMAKE_C_COMPILER not set / No CMAKE_CXX_COMPILER could be found — CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles" (macOS)CMake Error: CMAKE_C_…CMakeCache.txt directory is different — CMake Error: The current CMakeCache.txt directory is different than the directory where CMakeCache.txt was created (C/C++)CMakeCache.txt direct…conflicting types — C: error: conflicting types for 'foo' (C/C++)conflicting typesNo CMAKE_…

Explore the map of this error Full error map →

🧠 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.