This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
_GNU_SOURCE placement
- From: Baurjan Ismagulov <ibr at ata dot cs dot hun dot edu dot tr>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 25 Nov 2002 17:39:24 +0200
- Subject: _GNU_SOURCE placement
Hello,
I need to use sighandler_t in my program. Why does the following code
compile:
#define _GNU_SOURCE
#include <signal.h>
#include <locale.h>
sighandler_t a;
and the following does not:
#include <locale.h>
#define _GNU_SOURCE
#include <signal.h>
sighandler_t a;
"gcc -c signal2.c" output:
signal2.c:4: parse error before `a'
signal2.c:4: warning: data definition has no type or storage class
I've checked cpp output, it really doesn't contain "typedef
__sighandler_t sighandler_t;". However, if I compile via "gcc -c
-D_GNU_SOURCE signal2.c", it complains about redefinition, but generates
the object file.
What is the problem?
I've searched google, gcc and gcc-help archives, but couldn't find how
to solve this problem. I would be very grateful for any help.
I'm running Debian sid on an i386-pc-linux-gnu. I've tried both 2.95 and
3.2.1.
ii cpp-2.95 2.95.4-15 The GNU C preprocessor.
ii cpp-3.2 3.2.1-0pre6 The GNU C preprocessor.
ii gcc-2.95 2.95.4-15 The GNU C compiler.
ii gcc-3.2 3.2.1-0pre6 The GNU C compiler.
ii libc6-dev 2.3.1-3 GNU C Library: Development Libraries
Thanks in advance,
Baurjan.