Mail Archives: djgpp/1998/10/01/08:35:14
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.
- Raw text -