[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc 2.95 and Standard C



> > > Okay. I'm in a C class full of Borland C/C++ 4.5 for Windoze. Std C
> >libaries
> > > contain pow() and sqrt() (power and square root) in <math.h>.
> > >
> > > So where the fsck are they in gcc?????
> >
> >They are defined in <math.h>.  You also have to link it against libm.
> 
> Okay. Thank you.
> 
> gcc merely complained that it could not find functions named pow() and
> sqrt(), though I DID use:
> 
> #include<math.h>

It was the linker complaining, not the compiler.

gcc automatically calls the linker when it's done compiling
(unless you specify the "-c" option telling it not to, or
there are compile errors).

> And may I ask what the @*&#$ is libm, aside from, I presume, some addition
> to libc? And I do not remember libm being mentioned on the pow() or sqrt()
> man pages.

It's the system library that contain the math functions.
Separate from libc.

--------------------------------------------
Bruce Smith                bruce@armintl.com
System Administrator / Network Administrator
Armstrong International, Inc.
Three Rivers, Michigan  49093  USA
http://www.armstrong-intl.com/
--------------------------------------------