Ad Space — Top Banner

E2356

C++ Builder Programming Language

Severity: Minor

What Does This Error Mean?

E2356 means an identifier appears in two declarations with incompatible types. The message reads: E2356 type mismatch in redeclaration of 'identifier'. This is similar to E2040 but specifically focuses on the type disagreement between the two declarations. The fix is to find both declarations and make their types match, or remove the duplicate.

Affected Models

  • C++ Builder 10.x (Alexandria)
  • C++ Builder 11 (Sydney)
  • C++ Builder 12 (Athens)
  • RAD Studio 11 and 12

Common Causes

  • A function is declared in a header with one signature and defined in a .cpp with a different signature
  • Two headers included in the same translation unit define the same name with different types
  • A global variable is declared extern with one type in a header and defined with a different type in a .cpp
  • A forward declaration of a class is followed by a definition with the same name as a different kind (struct vs class)

How to Fix It

  1. Find both declarations. The error message points to the second one; look for the first by searching for the identifier name in your headers.

    In C++ Builder IDE, right-click the identifier and choose Find Declaration to navigate to the first occurrence.

  2. Compare the two type signatures and reconcile them. Decide which is correct and update the other to match exactly — return type, parameter types, and const qualifiers must all agree.

    A mismatch in just one parameter type or a missing const is enough to trigger E2356. Pay attention to pointer vs reference, int vs unsigned int, and const qualifiers.

  3. If the conflict comes from two third-party headers, use forward declarations or isolate the conflicting headers in separate translation units that do not include both.

    Namespace isolation is another option — wrap one of the includes in a namespace alias to separate the conflicting definitions.

Frequently Asked Questions

Can E2356 appear because of a missing const qualifier?

Yes — a function declared as void Foo(int x) and defined as void Foo(const int x) are different signatures in some contexts. More commonly, a method declared without const and defined with const (or vice versa) causes E2356. Ensure the declaration in the header and the definition in the .cpp are identical, including const qualifiers.