| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Message-Id: | <5.1.0.14.2.20020730195838.02bec170@pop3.cris.com> |
| X-Sender: | rrschulz AT pop3 DOT cris DOT com |
| Date: | Tue, 30 Jul 2002 20:00:16 -0700 |
| To: | =?BIG5?B?sWmr7a3X?= <changht AT cad DOT iie DOT ncku DOT edu DOT tw>, cygwin AT cygwin DOT com |
| From: | Randall R Schulz <rrschulz AT cris DOT com> |
| Subject: | Re: "parse error before" bug |
| In-Reply-To: | <20020731104833.C5C6.CHANGHT@ismp.iie.ncku.edu.tw> |
| Mime-Version: | 1.0 |
Hi,
You named the source file "go.c" and invoked the compiler with "gcc," so
your source code is being interpreted as C, not C++.
In C, all declarations must precede all executable lines within any given
block.
Randall Schulz
Mountain View, CA USA
At 19:49 2002-07-30, =?BIG5?B?sWmr7a3X?= wrote:
>hi
>
>i'm compiling a small program go.c like:
>
>----------------------------------------------
>#include <stdio.h>
>int main(){
> printf("parse error after this");
> int a;
>}
>----------------------------------------------
>
>with the error below:
>
>----------------------------------------------
>$ gcc go.c -o go
>go.c: In function `main':
>go.c:4: parse error before `int'
>
>----------------------------------------------
>
>i found removing the line "printf(....);" turns to be OK then.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |