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

Re: link err with #include<math.h>



Yup, that did it.  I'm used to borland and ms c on dos and windows
that seem to pull in these lib's automagicly.  I KNEW there was a
linker command to do this but couldn't find it.  Where is this
documented, and what other lib's do I need to look out for?
Thanks for the help.




---surak@imsa.edu wrote:
>
> > 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
> 

==
Amateur Radio, when all else fails!

http://www.qsl.net/wa2mze

Debian Gnu Linux, Live Free or .....


_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


Reply to: