delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/06/00:54:47

Date: Thu, 5 Aug 1999 15:36:47 +0200
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Message-Id: <199908051336.PAA11596@acp3bf.physik.rwth-aachen.de>
To: kdm98 AT spiritone DOT com (Keith McCormick)
Cc: djgpp AT delorie DOT com
Subject: Re: Only Errors... :-(
Newsgroups: comp.os.msdos.djgpp
Organization: RWTH Aachen, III. physikalisches Institut B
X-Newsreader: TIN [version 1.2 PL2]
Reply-To: djgpp AT delorie DOT com

In article <933846594 DOT 301468 AT ridge DOT spiritone DOT com> you wrote:
> Try indenting.  ie.,

> class Player
>   {
>    private:
>      int lives;

>    public:
>     void move(void);
>   };

Indentation will *never* solve any bug like this. C and C++ both don't
care a bit about how much whitespace you use, so indentation will
never solve a problem as severe as a parse error.

Back to the original problem: The real error is not in the fragment of
code we were given, but somewhere earlier in the program. The 'class
Player' line is not interpreted as the beginning of a statement, by
gcc, which is why it doesn't understand it, and complains with a
'parse error'. It simply didn't expect a class definition, at this
point of the source.

Most probable reason is that a closing } or ; was forgotten, or a
superfluous { found, before the 'class Player' line.

--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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