Expected unqualified-id before ‘)’ token

From Cppsyntax

Jump to: navigation, search

One way to get the error

  expected unqualified-id before ‘)’ token

is if you put parentheses on your class when declaring it:

WRONG

 class Foo()  // extraneous ()
 {
   // stuff
 }


RIGHT

 class Foo   // no ()
 {
   // stuff
 }

Another way to get this is accidentally putting a semicolon at the end of a define and then trying to use it in an initialization list.

WRONG

 #define STUFF 1.0;
 MyClass() : myVar(STUFF)  //STUFF puts extraneous ; in

RIGHT

 #define STUFF 1.0
Personal tools