[vox-tech] compiler error causing me great sadness
Ken Herron
kherron+lugod at fmailbox.com
Wed Sep 29 22:27:06 PDT 2004
--On Wednesday, September 29, 2004 11:06:50 PM -0400 Peter Jay Salzman
<p at dirac.org> wrote:
> #ifndef _FSIGNAL_H_
> #define _FSIGNAL_H_
>
> #define __GNU_SOURCE
> #include <signal.h>
> #include <stdio.h>
I think you want _GNU_SOURCE there, not __GNU_SOURCE. Though "#define
_POSIX_C_SOURCE 199309L" should be adequate.
> It's kind of a mess, but when I include __USE_POSIX and
> __USE_POSIX199309, I get "constant redefinition" errors. So instead, I
> add:
You aren't supposed to define the __USE_* macros yourself. See
<features.h>. Actually, when I ran your fsignal.h through "gcc -E" the
postprocessed C contained the siginfo_t definition. If you're not getting
it, then perhaps you've set one of the standard-selection macros to an
old standard such that __USE_POSIX199309 isn't supposed to be defined.
> How am I supposed to figure out how to get a definition for siginfo_t?
> Am I really supposed to grub around in the libc header files???
No, of course not. There are standards for this stuff, though programming
books don't always do a good job of explaining them. For example, on a
modern system running:
echo '#include <signal.h>' | gcc -E -
should get you a copy of the siginfo_t definition, but:
echo '#include <signal.h>' | gcc -E -D_POSIX_SOURCE -
because _POSIX_SOURCE implies a specific revision of the POSIX standard
that predates the siginfo_t type.
--
Ken Herron
More information about the vox-tech
mailing list