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

Re: sqrt C function



R1nso13@aol.com writes:

> when i try to use the sqrt function in gcc 3.0, and the gcc that's standard 
> with 2.2r3 ( i forget the version)  i get errors. here's some example code:

In general, you should post the exact errors when asking a question of
this sort, since it helps people find your problem more quickly.

In this case, I suspect the problem is you need to add "-lm" to the
compile line, like

cc     out.c -lm  -o out 

The math library is not linked in by default, even if you #include
<math.h>.  So you have to add the -lm.

-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!
The world is coming to an end.  Please log off.



Reply to: