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

Where is C 'pow' function?

>>>>> "Matt" == Matt Miller <mmiller@extremezone.com> writes:

    Matt> The following C program:
    Matt> #include <math.h>

    Matt> int main ()
    Matt> {
    Matt> double p = pow (2, 3);
    Matt> return 0;
    Matt> }

    Matt> fails to link.  ld issues the following complaint:

    Matt> undefined reference to `pow'

    Matt> Am I missing a library?  How can I search libraries to see which
    Matt> library has a given function?

    The compiler flag '-lm' is your friend. It will link in 'libm',
the standard math library.


Allan F. Caetano
Universo On Line - EngProd - F: (11) 224 4418
ComVc: 479966   ICQ: 68214944

"Who is this peer that keeps resetting my connection?
 I have a broken pipe I wanna hit him with!"

Reply to: