[ale] Incomplete math libraries?
Michael Hirsch
hirsch at mathcs.emory.edu
Tue Aug 31 21:49:26 EDT 1999
Justin Russell <jwrussell at fs1.mar.lmco.com> writes:
> I am trying to compile a C program which uses the sqrt() math function.
>
> I am using the gcc package which came with RedHat 6.0. The compiler is telling me it can't recognize
>
> the function sqrt(). Sure enough, I go look in /usr/include/math.h file and the sqrt() function is not defined.
>
> Does anyone know why this is? sqrt() exists in the man pages and it even says there that sqrt() is supposed to
>
> be defined in math.h. Any input helpful.
If you check all the files that math.h includes you will find it
"defined" in them, but only in the sense of being prototyped. It is
actually defined in the library libm.so. Add -lm to your compiler (or
linker) flags to link it in.
--
Michael
More information about the Ale
mailing list