This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "parse error before" bug


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]