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

Re: Simple c program won't compile

On Tue, Mar 06, 2001 at 12:26:30AM +1030, Mark Phillips wrote:
> Hi,

> 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 compile it like so:

gcc thick.c -lm

the -lm tells the linker to link in the math library.  

Ethan Benson

Attachment: pgpEeEskXVZM1.pgp
Description: PGP signature

Reply to: