views:

98

answers:

1

Hi, I am using the Eclipse CDT and I have a goto label and a FILE definition after it and when I compile the project it gives me the error: Expression expected before FILE.

Thanks in advance, Mr. Man

EDIT:

Ok, so this is what I get from the command line:

iOS.c: In function ‘main’:
iOS.c:45: error: expected expression before ‘FILE’
iOS.c:49: error: ‘preFile’ undeclared (first use in this function)
iOS.c:49: error: (Each undeclared identifier is reported only once
iOS.c:49: error: for each function it appears in.)`

And this is what code throws the error:

fileExists:

FILE *preFile = fopen("prefix.txt","r");
+3  A: 

As you're coding in C, you need to declare the variable at the beginning of the function:

void foo()
{
  FILE* preFile;

  // some code

  fileExists:
  preFile = fopen("prefix.txt","r");
}
Gregory Pakosz
Thanks, this got it working.
Mr. Man