Mark Phillips <[EMAIL PROTECTED]> writes:

> Hi,
> 
> The following program:
> 
> 
> #include <stdio.h>
> #include <math.h>
> 
> int main(int argv, char **argc){
>   double x;
> 
>   x=sqrt(5.0);
> }
> 
> 
> does not compile.  Instead I get the errors:
> 
> $ gcc thick.c
> /tmp/ccU9fgSr.o: In function `main':
> /tmp/ccU9fgSr.o(.text+0x16): undefined reference to `sqrt'
> collect2: ld returned 1 exit status
> 
> 
> What is wrong?


You need to link against the math library.

$ gcc thick.c -lm

-Anthony

Reply via email to