[comp.unix.programmer] C libraries

bc@uxa.cso.uiuc.edu (Ben Cox) (01/03/91)

xialin@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@uxa.cso.uiuc.edu