Re: can't compile with sqrt from math.h

From: jpd (read_the_sig_at_do.not.spam.it.invalid)
Date: 07/14/05


Date: 14 Jul 2005 15:38:38 GMT

Begin <uynBe.48014$oJ.8723@news-server.bigpond.net.au>
On 2005-07-14, bsder <bsder@bsder.com> wrote:
> Can anyone please help me resolve the following compliation error? The
> following C program failed to compile:
[snip]
> #gcc time-space-2.c
> /var/tmp//ccV6bjTC.o(.text+0x21e): In function `main':
>: undefined reference to `sqrt'

That's not a compilation error, it's a linking error. You need to link
the math library (-lm).

-- 
  j p d (at) d s b (dot) t u d e l f t (dot) n l .


Relevant Pages

  • Re: Function to count workdays
    ... even compile code before moving it to production, ... I prefer handling holidays ... That's why experienced programmers write tests. ...
    (comp.databases.ms-access)
  • Re: Compiling the scriptbasic package
    ... configuring module bdb ... The module did not compile ... dll FAIL lib FAIL bas OK ...
    (comp.os.linux.misc)
  • Re: A C Adventure: your comments are welcome
    ... Compilers don't bother reading your sociology claptrap excuses - ... they can simply say "syntax error" and be done with you. ... Once you've got something that I can compile and link, ...
    (comp.lang.c)
  • Re: Java web services
    ... > * Use WSDL2Java to create classes based on the supplied WSDL, ... > that the JDK be in the classpath, and compile the necessary classes on ...
    (comp.lang.java.programmer)
  • Re: 200x wish list
    ... Albert van der Horst wrote: ... <SNIP> ... to check whether] is used when there is no definition in progress. ... It's an error to compile anything without a definition started to ...
    (comp.lang.forth)