I'm trying to use the sqrt() function in Linux with GCC v3.3.6,
compiling with this command:
$ gcc sourcefile.c
I get this error:
In function 'main': undefined reference to 'sqrt'
collect2: ld returned 1 exit status
Here is my source code:
#include <stdio.h>
#include <math.h>
main()
{
double num, sq_double;
scanf("%d", &num);
sq_double = sqrt(num);
}
What am I doing wrong? Is there something special I need to do to use
the math.h functions?