-1

Good morning.
I'm coding in C for a school project and i keep facing this error in the functions.h where i type

#ifndef FUNCTIONS_H_INCLUDED 
#define FUNCTIONS_H_INCLUDED
#define DIMID 4
#define COO 2
#define DIM 20

FILE *data1;
FILE *data2;
FILE *out;

It always gives the error message:

"error: FILE does not name a type"

These Files are used throughout the code but as an example I show 2 bellow

void comandp(cellphone *tel1,read *read,FILE *out);
void infected(cellphone *head,read *read,FILE *out); 

Where it returns the error message:

"Error: 'File' has not been declared"

Does anyone have any clue as to what I'm doing wrong and how to fix this issue?
Thank you so much

  • 1
    Note that you are also using the conditional preprocessor directive without a `#endif`. Look at https://www.cprogramming.com/reference/preprocessor/ifndef.html. If you are beginning to learn C, I really suggest you go check out the first five classes of the Harvard CS50 course that is on youtube. C is a bit tricky and it's better to start with solid foundations or it will feel like you are fighting it all the time. – cassepipe Jan 20 '21 at 14:00
  • I already know C, and the #endif was at the bottom at the bottom of the code. As it turns out i was forgetting to do #incluude. Thank you though :) – Rodrigo Oliveira Jan 20 '21 at 14:16

1 Answers1

2

You will need to include the library header #include <stdio.h> if you wish to use the inherent structure of FILE or create the structure of FILE in another location.

KillaBytes
  • 447
  • 3
  • 10