C libraries

Ben Cox bc at uxa.cso.uiuc.edu
Thu Jan 3 22:53:24 AEST 1991


xialin at umd5.umd.edu (Xia Lin) writes:


>I would like to use some math functions in <math.h> in my C program (in unix).
> The compiler keeps telling me that "undefined:   _exp, _sqrt", even though I
> have included a "#include <math.h>" statement at the begining of my program. 
>What did I do wrong? Do I need to use some compiler options like "cc -?" for using library functions?
>Thanks in advance for any helps.

cc foo.c -lm
         ^^^ This is the important part -- link in the math library.

--
-- Ben Cox
bc at uxa.cso.uiuc.edu



More information about the Comp.unix.programmer mailing list