Question

I'm developing something on Minix 3 and, when it comes to deal with io files, I got a problem. In the code:

#include <stdio.h> /* If I don't call any stdio funcs compiler doesnt's complain*/
int main() {
  FILE * fp; /* I get the following: " * not expected " */
  return 0;
}

Already tried everything that comes to my mind, can't figure it out..

/EDIT/ From what I can tell, when I include something, if I call functions not related to structs, it's OK. Is it the structs ?

Était-ce utile?

La solution

I will assume you have checked whether the Minix file is present, that it really defines the type FILE and that your include path provides the correct -Ioption to the compiler to find that file.

Depending on your environment it could happen that an environment variable INCLUDE exists and is recognized by your compiler to provide additional include paths, recognized even before the include options from the command line. In such a case it might happen to include a stdio.hfrom a different compiler. Visual Studio is known to provide such an environment variable by default, and that has bitten me once before.

EDIT: Running the preprocessor in isolation may help to find out what is really happening in any case. Verify that FILEis defined in the preprocessed version of your file.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top