Problems with math.h

Alexandre Oliva oliva@lsd.ic.unicamp.br
Fri Jan 7 00:51:00 GMT 2000


On Jan  7, 2000, tobias_meier@my-deja.com wrote:

> gcc MatheTest.c
> /tmp/ccdP8Uys.o: In function `main':
> /tmp/ccdP8Uys.o(.text+0xe): undefined reference to `exp'
> /tmp/ccdP8Uys.o(.text+0x37): undefined reference to `pow'
> collect2: ld returned 1 exit status

math.h is a *header*-file, it just supplies* declarations* of the math
functions.  The *definitions* have already been compiled, and live in
the math *library*.  You can link your program with the math library
by adding `-lm' to the compile+link command.

-- 
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them



More information about the Gcc-help mailing list