Re: math.h - exp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 04, 2003 at 05:53:54AM +0200, didier wrote:
> I have installed gcc 3.3.1 on a PC-linux system, with bootstrap by gcc 
> 2.96. Every thing was right. But in a test program, the calll of the 
> "exp" function generated an error message " undefined reference to 
> 'exp', thought I include the file <math.h>. What is the reason ?

Including a header file usually is not enough as it usually only
contains function declarations / prototypes. You need to link with the
math library `libm' which provides the compiled code for the various
math functions such as `exp':

gcc prog.c -lm

-- 
Claudio Bley                                 ASCII ribbon campaign (")
Debian GNU/Linux user                         - against HTML email  X 
http://www.cs.uni-magdeburg.de/~bley/                     & vCards / \


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux