Tuesday, January 13, 2015

Missing semi-colon

Thought I'd highlight this error message:

class foo
{
  foo();
}

foo::foo() 
{ }
$ CC -c c.cpp
"c.cpp", line 6: Error: A constructor may not have a return type specification.
1 Error(s) detected.

The problem is that the class definition is not terminated with a semi-colon. It should be:

class foo
{
  foo();
};  // Semi-colon

foo::foo() 
{ }