gcc math.h won't include

Jerry Feldman gaf at corsof.com
Fri Feb 27 14:56:36 EST 1998


On 27 Feb 98 at 13:40, Mark Glassberg wrote:

> I'm running linux on a 486 based pc, and trying to teach myself C.  A program
> in a book I'm studying has the "#include <math.h>" line but gcc give an error
> that it doesn't understand the term "pow", which is supposed to be defined in
> the included file.  Does anyone have an idea what's causing this problem?
Math.h does include the function prototypes for the pow function. You 
do not provide enough information. Is it complaining about math.h, or 
your use of the pow function in your program, of is it a linker 
message where it is saying that you have an unidentified reference. 
When you compile, you need to use the -lm command line flag, which 
causes the math library (eg. libm.so) to be included by the linker. 
Gerald A. Feldman <gaf at corsof.com>
home:gaf at mediaone.net



More information about the Discuss mailing list