Problem about initialize a mutex object in a class

jlh jlh@gmx.ch
Mon May 7 08:19:00 GMT 2007


Hello!

Your class definition is missing the semicolon after the closing
brace.  My g++-4.1.1 even warns about it:

a.c:11: error: new types may not be defined in a return type
a.c:11: note: (perhaps a semicolon is missing after the definition of 'Thread')
a.c:11: error: return type specification for constructor invalid

Because of the missing semicolon, the class is parsed as the
return type of the following constructor, i.e., as in "int func()"
it parses "class { } func()", and only later notices that
constructors shouldn't have a return type.

jlh



More information about the Gcc-help mailing list