From: Richard Newsgroups: comp.os.msdos.djgpp Subject: Re: WEIRD GCC error Date: Thu, 01 Oct 1998 14:21:30 -0700 Organization: - Lines: 39 Message-ID: <3613F259.97C@dds.nl> References: <3612BEEB DOT 697F AT dds DOT nl> Reply-To: budha AT dds DOT nl NNTP-Posting-Host: annex1s38.urc.tue.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.03 (Win95; I; 16bit) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp This code is valid C++, but the problem is that gcc complains about it. Does anyone know what's wrong? Richard wrote: > > // When this code is compiled (w. gcc), the following errors are given: > > // Compiling: test.cpp > // rgb.cpp(25) Error: semicolon missing after declaration of `struct > Class1::Abc' > // In method `int Class2::Func(class Class2 *)': > // rgb.cpp(29) Error: parse error before `;' > // There were some errors > > // What is the problem here? (in Borland C++ this works) > // Thanks, Richard. (Please cc your solution to my email address) > > class Class1 > { public: > typedef char byte; > typedef struct { byte a; byte b; byte c; } Abc; > }; > > class Class2 : public Class1 > { public: > Abc Func(void); > }; > > Class1::Abc Class2::Func(void) > { Abc abc; // this is line 25 > abc.a='a'; > abc.b='b'; > abc.c='c'; > return abc; // this is line 29 > } > > // end.