New types may not be defined in a return type

From Cppsyntax

Jump to: navigation, search

The error

 new types may not be defined in a return type

can be caused by forgetting a semicolon on the end of the declaration of a class.

WRONG

foo.h:

 class Foo
 {
   // stuff
 }               // missing semicolon

foo.cc:

 #include "foo.h"
 Foo::Foo(int x)  // error shows up in this line
 {
   // stuff
 }


RIGHT

foo.h:

 class Foo
 {
   // stuff
 };               // yay, semicolon!

foo.cc:

 #include "foo.h"
 Foo::Foo(int x)
 {
   // stuff
 }
Personal tools