My manual page of fstat
says to also include sys/types.h
, and that solves the problem for me. The definition of ino_t
in sys/stat.h
is protected with the feature macros __USE_XOPEN
and __USE_XOPEN2K
. The definition in sys/types.h
is not protected that way.
The manual page also says to include unistd.h
, but that wasn't necessary to solve your problem.
According to the manual page of feature_test_macros
:
__STRICT_ANSI__
ISO Standard C. This macro is implicitly defined by gcc(1) when invoked with, for example, the-std=c99
or-ansi
flag.
I guess this means that any XOPEN features are also switched off. I could however not find any description of that.
P.S. It seems R.. (see below) feels that this is described also in the manual page of feature_test_macros
, but my limited brain is not able to find the exact wording, so I'd like to leave that as an exercise to the reader. If it were described anywhere, then I would expect it in that manual page indeed.
Beware that the gist of this answer is as follows:
Thou shall include all include files mentioned in a manual page and not try to reverse engineer which ones may not be needed.