math.h doesn't include pow?
seebs at plethora.net
Mon Nov 8 11:04:04 PST 2004
In message <firstname.lastname@example.org>, 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). ;-)
Headers and libraries are distinct. Headers provide prototypes; libraries
provide definitions. You want "-lm".
More information about the freebsd-questions