delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/30/10:50:13

From: Richard <budha AT dds DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: WEIRD GCC error
Date: Wed, 30 Sep 1998 16:30:25 -0700
Organization: -
Lines: 32
Message-ID: <3612BEEB.697F@dds.nl>
Reply-To: budha AT dds DOT nl
NNTP-Posting-Host: annex1s53.urc.tue.nl
Mime-Version: 1.0
X-Mailer: Mozilla 3.03 (Win95; I; 16bit)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

// 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019