What does expected ')' mean in C++?

Updated October 2026 · How we answer

Short answerIt means the compiler found an opening parenthesis without a matching closing parenthesis before the end of the statement. The error often points to a line after the actual missing parenthesis.

Common causes

This error typically occurs when you forget a closing parenthesis in a function call, function declaration, or control statement like if or while. The compiler reports the line where it expected the ')' but couldn't find it.

Other causes include mismatched parentheses in complex expressions, missing semicolons before a parenthesis, or using a macro that expands incorrectly.

  • Missing closing parenthesis in a function call or definition
  • Unbalanced parentheses in a mathematical expression
  • Forgetting a semicolon before a line that starts with a parenthesis
  • Incorrect use of macros that contain parentheses

How to fix it

Check the line number in the error message and look for an opening parenthesis that doesn't have a closing one. Count parentheses from the start of the statement.

If the error is in a complex expression, break it into smaller parts or use an editor with bracket matching. Also check the line before the reported error for a missing semicolon.

  • Count parentheses to ensure they match
  • Check the line before the error for a missing semicolon
  • Use an IDE with parenthesis matching and syntax highlighting
  • Simplify complex expressions to isolate the issue

Common mistakes

  • Assuming the error is on the exact line shown; it's often earlier.
  • Forgetting that a missing semicolon can cause an 'expected )' error on the next line.
  • Ignoring that macros can expand to unbalanced parentheses, leading to confusing errors.
From our shopsCASEONYX: Dark-luxe tough phone cases.