Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Nov 2004 13:03:54 -0600
From:      seebs@plethora.net (Peter Seebach)
To:        Vince Sabio <vince@vjs.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: math.h doesn't include pow? 
Message-ID:  <200411081904.iA8J41Ff009205@herd.plethora.net>
In-Reply-To: Your message of "Mon, 08 Nov 2004 14:00:33 EST." <p05200f14bdb56efeb236@[192.168.0.5]> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <p05200f14bdb56efeb236@[192.168.0.5]>, Vince Sabio writes:
>My C library documentation states that the "pow" (power) function is 
>included in math.h. However, when I go to link (compiling and linking 
>with gcc), I get the following:
>
>In function `[function name]':
>[path/]datetime.c:668: undefined reference to `pow'
>
>Yes, I'm including <math.h>. If I compile the exact same code under 
>Darwin (BSD on PowerPC), it compiles fine. It also compiles in 
>CodeWarrior. Is anyone else familiar with this problem? Could I have 
>a path set up incorrectly, and be using the wrong libraries?
>
>Running FreeBSD v5.1, installed from CD, including the developer 
>tools. Single-boot system; there is no Microsoft software anywhere on 
>the machine, so it's not their fault (for a change). ;-)

FAQ.

Very FAQ.

Headers and libraries are distinct.  Headers provide prototypes; libraries
provide definitions.  You want "-lm".

-s



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411081904.iA8J41Ff009205>