public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* math.h - exp
@ 2003-09-04  3:51 didier
  2003-09-04  9:50 ` Claudio Bley
  0 siblings, 1 reply; 2+ messages in thread
From: didier @ 2003-09-04  3:51 UTC (permalink / raw)
  To: gcc-help

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 ?

Thanks

Didier


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: math.h - exp
  2003-09-04  3:51 math.h - exp didier
@ 2003-09-04  9:50 ` Claudio Bley
  0 siblings, 0 replies; 2+ messages in thread
From: Claudio Bley @ 2003-09-04  9:50 UTC (permalink / raw)
  To: gcc-help

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 / \

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-04  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-04  3:51 math.h - exp didier
2003-09-04  9:50 ` Claudio Bley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).