Expected declaration qualifiers or "... before" FILE

I am writing code in c.
I declare FILE * fp in the main function (main.c).
We have other files in the project.
Therefore, in the header file, I get this error:
"expected declaration qualifiers or" ... before the "FILE problem"
on this line:
void myfunct (argument argument, FILE * fp),

What am I doing wrong?

Work on Linux (gedit + gcc).

+3
source share
2 answers

You must include the header before using the typedef'd element, otherwise FILEit means nothing to the compiler, and it does not know what it is looking at.

+1
source

argumenttype .

typedef struct testStruct testptr;
void myfunct(testptr test, FILE *fp);

stdio.h . . , , , typedef'ed, ?

!

0

All Articles