gamma(lgamma) error in libm(signgam undeclared)

J. Johnston
Thu Apr 19 10:35:00 GMT 2001

Cliff Tsai wrote:
> Hi:
>     When using gamma and lgamma in libm,
>     I have the error: siganam undeclared.
>     And after adding following two lines(suggestion from From: "J. Johnston"
> <jjohnstn at cygnus dot com>
>         Date: Mon, 29 Jan 2001 18:01:30 -0500 )
>     extern __IMPORT struct _reent reent_data;
>     #define signgam reent_data._new._reent._gamma_signgam
>     I have another problem:undefined reference to `reent_data'.
>     I've seen the struct _reent is defined in sys/reent.h .
>     math.h also have #include <sys/reent.h>.
>     But I still can't find out what's the problem!
>     Thanks for any help!


  The signgam stuff was reworked about that time into an errno-like solution.  Make sure you have
the patch from 01-29 applied or just use the current CVS sources:

2001-01-29  Jeff Johnston  <>

        * libc/include/math.h (signgam): Change to errno-like solution
        using a function to return the address of the real signgam.
        * libc/reent/signgam.c: New file containing __signgam().
        * libc/reent/ Added signgam.c to list of files.
        * libc/reent/ Regenerated.

In your application, you need:

    #include <math.h>

    extern int signgam;

-- Jeff J.

More information about the Newlib mailing list