Re: link err with #include<math.h>
- To: debian-user@lists.debian.org
- Cc: scharkalvin@yahoo.com (Kenneth Scharf)
- Subject: Re: link err with #include<math.h>
- From: surak@imsa.edu
- Date: Sat, 27 Feb 1999 17:07:30 -0600 (CST)
- Message-id: <199902272307.RAA23506@afri.edu.>
- In-reply-to: <19990227202525.7816.qmail@murphy.debian.org> from "debian-user-digest-request@lists.debian.org" at Feb 27, 1999 08:25:25 PM
> I got the following error with the attached program when attempting to
> compile with "gcc coil1.c".
>
> /tmp/ccc00256: In function `main':
> /tmp/ccc00256<.txt+0x92): undefined reference to `sqrt'
>
>
> I assume that this is a link error and that the required lib is not being
> included. What am I doing wrong?
When including math.h, you need to use the "-lm" argument to gcc to tell it
to link to the math library. "gcc coil1.c -lm" should do the trick.
Hope that helps,
Alan
surak@imsa.edu
Reply to: