math.h doesn't include pow?

Vince Sabio vince at vjs.org
Mon Nov 8 11:21:00 PST 2004


** Sometime around 13:03 -0600 11/08/2004, Peter Seebach sent everyone:
>In message <p05200f14bdb56efeb236@[192.168.0.5]>, Vince Sabio writes:
>
>>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?
>
>FAQ.
>
>Very FAQ.

I thought it must have been, so I searched my list archives -- which, 
admittedly, go back only to January of this year -- but didn't find 
anything on this problem. If there's a formal FreeBSD FAQ, I'd be 
happy to be clue-batted with it FFR.

>Headers and libraries are distinct.  Headers provide prototypes; libraries
>provide definitions.

Yes, my bad; sorry about that:

% sed 's/libraries/headers/'

>You want "-lm".

Ah! Yes, that did the trick. Muchas gracias, or however those wacky 
Irish spell it....
-- 

__________________________________________________________________________
Vince Sabio                                                  vince at vjs.org


More information about the freebsd-questions mailing list