Re: link err with #include<math.h>
- To: email@example.com
- Cc: firstname.lastname@example.org (Kenneth Scharf)
- Subject: Re: link err with #include<math.h>
- From: email@example.com
- Date: Sat, 27 Feb 1999 17:07:30 -0600 (CST)
- Message-id: <199902272307.RAA23506@afri.edu.>
- In-reply-to: <firstname.lastname@example.org> from "email@example.com" 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,