[vox-tech] compiler error causing me great sadness

Peter Jay Salzman p at dirac.org
Wed Sep 29 20:06:50 PDT 2004


This is causing me great pain...



This is the compiler error:

p at satan$ make
colorgcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return
-Wpointer-arith -Wcast-qual -Wcast-align -Wmissing-declarations
-Wnested-externs -Wredundant-decls -Wwrite-strings -Winline -Werror -std=c99
-g3   -c -o avataralt.o avataralt.c
In file included from avataralt.c:5:
fsignal.h:15: error: parse error before "siginfo_t"
fsignal.h:15: warning: function declaration isn't a prototype
fsignal.h:16: error: parse error before "siginfo_t"
fsignal.h:16: warning: function declaration isn't a prototype
make: *** [avataralt.o] Error 1



The header file causing me grief is:

   #ifndef _FSIGNAL_H_
   #define _FSIGNAL_H_

   #define __GNU_SOURCE
   #include <signal.h>
   #include <stdio.h>

   /* Enable FPE's, by default all FPE's will not raise a signal when 
    * they happen... see fenv.h for magic constants. */
   void fpe_trap_enable(void);
   void Initialize_Signals(void);
   void fpe_print_cause(FILE *file, siginfo_t *info);
   void fpe_callback(int sig_number, siginfo_t *info, void *data);
   void int_callback(int sig_number);

   #endif


The definition for siginfo_t isn't being pulled in, even though it SHOULD be
in signal.h.   But why is gcc telling me:

   warning: function declaration isn't a prototype

What's that supposed to mean?  Why isn't the declaration a prototype?  That's
just bizarre!  It sure looks like a prototype!  My implicit assumption is
that the warning is related to the error.  Maybe they're unrelated.  I dunno.

Looking through signal.h, I see:


   # ifdef __USE_POSIX199309
   /* We need `struct timespec' later on.  */
   #  define __need_timespec
   #  include <time.h>

   /* Get the `siginfo_t' type plus the needed symbols.  */
   #  include <bits/siginfo.h>
   # endif


It's kind of a mess, but when I include __USE_POSIX and __USE_POSIX199309, I
get "constant redefinition" errors.  So instead, I add:

   #include <bits/siginfo.h>

to my header file, and voila, the program compiles.


OK, I figured this out with a cockamamy fix.  Now I want to know how I'm
_really_ supposed to make this compile.

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???

Pete


-- 
Make everything as simple as possible, but no simpler. -- Albert Einstein
GPG Instructions: http://www.dirac.org/linux/gpg
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D


More information about the vox-tech mailing list