This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 4.8.1 unable to compile a .c File


On Sat, 2019-03-23 at 22:54 +0530, Vinaya Dandur wrote:
> My mistake. Thanks, but even if you include <signal.h> the issue still
> exists. Yes TRAP_BRKPT is not included in signal.h, however gcc somehow
> finds the definition for TRAP_BRKPT and I don't know how. This works in
> other hosts.

A peruse of the sigaction man page for GNU/Linux might be enlightening:

http://man7.org/linux/man-pages/man2/sigaction.2.html

> Since glibc 2.20, the definitions of most of these symbols are
> obtained from <signal.h> by defining feature test macros (before
> including any header file) as follows:
> 
>   *  _XOPEN_SOURCE with the value 500 or greater;
>   *  _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED; or
>   *  _POSIX_C_SOURCE with the value 200809L or greater.
> 
> For the TRAP_* constants, the symbol definitions are provided only
> in the first two cases.  Before glibc 2.20, no feature test macros
> were required to obtain these symbols.

So if you add #define _XOPEN_SOURCE 500 or both #define _XOPEN_SOURCE
and #define _XOPEN_SOURCE_EXTENDED before your first #include, or if
you add -D_XOPEN_SOURCE=500 or both -D_XOPEN_SOURCE and
-D_XOPEN_SOURCE_EXTENDED to your compile line, then things should work.

This is a question related to the GNU libc project, not GCC.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]