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

Re: Simple c program won't compile



Mark Phillips wrote:
> 
> 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?

a) You need to add "-lm" to link in the math library
b) Your .sig gives me a headache

-- 
Mike.Moran@ee.ed.ac.uk 
                   Web: http://houseofmoran.com/
               AvantGo: http://houseofmoran.com/Lite/



Reply to: