www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/15/01:13:06

Date: Thu, 15 Oct 1998 06:11:42 +0100 (BST)
From: George Foot <george DOT foot AT merton DOT oxford DOT ac DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Parse errors
In-Reply-To: <703q7p$bus$1@nnrp1.dejanews.com>
Message-ID: <Pine.OSF.4.05.9810150604520.1537-100000@sable.ox.ac.uk>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Thu, 15 Oct 1998 silkwodj AT my-dejanews DOT com wrote:

> C:\Work\pcx >gcc pcxview3.cc pcx.o myscrn1.o myscrn2.cc -o pcxview.exe
> pcxview3.cc:71: parse error at end of input.
> 
> Now my pcxview3.cc file has only 70 lines in it!  What's also baffling is the
> file pcx.o was compiled a couple of weeks ago, but now I can't compile it
> again. I get the same kind of error message for the end of its 276 lines of
> code.

It probably is a missing brace; look again out for mismatched
braces.  Do you indent your code?  That helps you to keep track
of the brace depth.

A trick you can use (nasty!) is to write `bleah();' at the end
of your file, on line 71.  Assuming you don't have a function by
that name (change it if you do), gcc should barf on this and
tell you what function it thinks it is in at the moment.  This
should give you some clue as to where the missing brace is.

A problem could be the fact that a gcc extension allows you to
define one function within another.  You can disable this by
passing `-ansi' or `-traditional', but both of these may make
your code fail to compile for other reasons.

Another possibility is that you have an unterminated string
or character constant -- i.e. missing " or '.

If the problem is any of these, changing the order of functions
probably won't do too much.

Another way to find the problem is to insert an extra closing
brace at the end.  This isn't a solution yet!  The code should
now compile (possibly with other errors).  If so, move the brace
back in the file, putting it just before the last function.
Keep doing this until you get a parse error before your newly
inserted brace; at that stage you know that the missing closing
brace is in fact in the next function, after this new parse
error occured.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

xu do tavla fo la lojban  --  http://xiron.pc.helsinki.fi/lojban/lojban.html

- Raw text -


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