Ad Space — Top Banner

E2188

C++ Builder Programming Language

Severity: Minor

What Does This Error Mean?

E2188 means the compiler found an invalid expression — something that should evaluate to a value but is syntactically broken. Common examples: a binary operator with no left operand, a function call with mismatched parentheses, or an empty expression where a value is required.

Affected Models

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

Common Causes

  • A binary operator (such as +, *, /) used with only one operand
  • Mismatched or missing parentheses in a complex expression
  • An empty return statement in a function that is declared to return a value
  • A comma used where C++ does not allow it — such as in certain template or macro contexts
  • A stray semicolon inside a for-loop condition or other expression context

How to Fix It

  1. Look at the expression on or near the reported line. Verify that every binary operator has values on both sides, and every function call has matching open and close parentheses.

    E2188 often results from a typo that removes one character from an otherwise valid expression. Reading the expression aloud — left to right — helps identify where the structure breaks down.

  2. Check return statements in functions that return a value — return; (no value) in a non-void function causes E2188.

    If you want to return early from a void function, that is fine: return; For a function declared to return int or another type, a value is required: return 0;

  3. Check for-loop conditions for stray semicolons. A for(;;) is an infinite loop and is valid, but for(i = 0; ; i < 10) has the condition and increment swapped, producing E2188.

    The three parts of a for loop are: initialiser; condition; increment. An expression in the wrong slot may be syntactically invalid and trigger E2188.

Frequently Asked Questions

E2188 appears in a header I did not modify — why?

A syntax error in your own code can corrupt the compiler's parser state, causing it to misparse a subsequent header. Fix all errors in your own code first — errors in system or VCL headers are almost never the root cause.

Can a macro expansion cause E2188?

Yes — a macro that expands to an incomplete expression causes E2188 at the point of use. Expand the macro manually by substituting its definition and check whether the result is a valid expression.