www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/15/12:14:54

Date: Thu, 15 Jan 1998 19:13:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: HackerOC3 <hackeroc3 AT aol DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: parse errors
In-Reply-To: <19980115130300.IAA15160@ladder01.news.aol.com>
Message-ID: <Pine.SUN.3.91.980115191142.13190B-100000@is>
MIME-Version: 1.0

On 15 Jan 1998, HackerOC3 wrote:

> printf("y value?");
> int y;
> scanf(" %d", &y);
> printf("color value?");
> int c;
> scanf(" %d", &c);
> 
> In above code, i get parse errors before int.  I also sometimes get parse
> errors in function prototypes for seemingly invaild reasons.  Please help!!

You are obviously assuming that this code will be compiled as C++ (it is 
illegal in C to put declarations such as "int y;" after executable 
statements).  But GCC compiles *.c files as C, not C++, so you get burned.

You need to rename your source file to have a .cc extension, then it will 
work.

- Raw text -


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