Error:Code:# include <stdio.h> # include <stdlib.h> # include <math.h> int main () { double k; double x; printf ("Enter a number ... \n"); scanf ("%f", &k); x = sqrt (k); // x = cos (k); printf ("Square root is %f\n", x); return 0; }
/tmp/cc2E1F0F.o(.text+0x3e): In function `main':
: undefined reference to `sqrt'
collect2: ld returned 1 exit status
I am working in linux platform and i do not why do i get this error. I think non of the math.h functions are not working. But I included math.h. any suggestions?



LinkBack URL
About LinkBacks



for linking to the math library that contains the definition of sqrt().