Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

expected declaration specifiers or ‘...’ before ‘FILE’

I am writing code in c.
I am declaring a FILE* fp at the main function (main.c).
We have other files at the project too.
So at a header file I am getting this error:
"expected declaration specifiers or ‘...’ before ‘FILE’ problem"
at this line:
void myfunct(argumenttype argument, FILE *fp);

What am I doing wrong?

Working in Linux(gedit+gcc).


1 Answers

You must include the header before you use the typedef'd element, otherwise FILE means nothing to the compiler, and it doesn't know what it is looking at.

like image 200
jonsca Avatar answered Sep 23 '26 15:09

jonsca



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!