I have a C file which is exhibiting some strange behavior. When I use id_t
, the compiler claims it's not defined (it's defined in sys/types.h
). Here's what's weird: I include sys/acl.h
, which in turn includes sys/types.h
. In the sys/acl.h
header file itself, id_t
is referenced, and the compiler doesn't complain about that. Further, when I remove my reference to it, the entire thing compiles properly, implying that the compiler hit sys/acl.h
's use of id_t
and didn't have a problem with it. Any idea what could be going on?
EDIT: sys/acl.h
uses id_t
in a define, which means it's not actually getting used; my bad on that one.
EDIT: using gcc -E
(thanks for the tip, @kaylum), I figured out that the definition isn't getting included in the build. It's surrounded by the following guards:
#if (defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8) \
&& !defined __id_t_defined
typedef __id_t id_t;
# define __id_t_defined
#endif
I tried using -D__USE_SVID
, and it did nothing. I also tried adding #define __USE_SVID
above the include statement, and it also did nothing.
EDIT: Figured it out; see this answer to another SO question. I switched to using -std=gnu99
(from -std=c99
) and it worked.