I'm experiencing a strange problem with some C code I am writing. Consider the following code:
#include <sys/stat.h>
ino_t inode;
According to POSIX.1-2008, the header file <sys/stat.h> defines ino_t
1:
The <sys/stat.h> header shall define the
blkcnt_t
,blksize_t
,dev_t
,ino_t
,mode_t
,nlink_t
,uid_t
,gid_t
,off_t
, andtime_t
types as described in <sys/types.h>.
This happens when I try to compile the source code above places in a file test.c on my Linux system:
$ cat test.c #include <sys/stat.h> ino_t inode; $ uname -srm Linux 3.8.0-26-generic x86_64 $ lsb_release -d Description: Ubuntu 13.04 $ gcc -c test.c $ gcc -std=c90 test.c test.c:2:1: error: unknown type name 'ino_t' $ gcc -std=c99 test.c test.c:2:1: error: unknown type name 'ino_t' $ gcc -std=c1x test.c test.c:2:1: error: unknown type name 'ino_t'
Why is the definition of ino_t
not revelead when I specify any -std option?