marked override but does not override C/C++ Origin: Application & API OSI layer 7 · Application Last updated 28 Nov 2026

C++: error: 'void D::f()' marked 'override', but does not override

A method has override, but no virtual function in the base class has exactly that signature.

Exact message you may see marked 'override', but does not overridemarked override but does not overridemethod with override specifier did not override
Seen on: C/C++ GCC Clang

Meaning

A tiny signature difference — const, parameter type, reference, or name spelling — makes it a new function instead of an override. override turns that silent bug into an error.

Common causes

  • Missing or extra const
  • Parameter types differ (int vs long)
  • Base method not virtual
  • Misspelled name

⚡ Quick fix

  1. Make the signature identical to the base
  2. Declare the base function virtual
  3. Remove override only if you intend a new function

Detailed fix by platform

GCC / Clang

  1. Compare declarations side by side; use -Woverloaded-virtual to see hidden functions

Code examples

const mismatch

cpp
struct Base { virtual void draw() const; };
struct Derived : Base { void draw() override; };   // error: marked 'override' but does not override (missing const)

How to diagnose

  1. Signature — Same params, const, noexcept?
  2. Virtual — Base virtual?
  3. Name — Spelling?

🔧 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):

C2259 — MSVC: error C2259: 'X': cannot instantiate abstract class (C/C++)C2259cannot 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…cannot declare variable to be of abstract type — C++: error: cannot declare variable 'x' to be of abstract type 'Shape' (pure virtual functions) (C/C++)cannot declare variab…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…conflicting types — C: error: conflicting types for 'foo' (C/C++)conflicting typesNo CMAKE_CXX_COMPILER could be found — CMake Error: No CMAKE_CXX_COMPILER could be found (C/C++)No CMAKE_CXX_COMPILER…non-virtual destructor — C++: warning: deleting object of polymorphic class type 'Base' which has non-virtual destructor might cause undefined behavior (C/C++)non-virtual destructornot a constant expression — C++: error: call to non-'constexpr' function / expression is not a constant expression (C/C++)not a constant expres…marked ov…

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.