Re: [code] POW problem...

From: Angus Mezick (angus@EDGIL.CCMAIL.COMPUSERVE.COM)
Date: 09/03/97


on a UNIX box you HAVE to use the -lm switch to include the math library... I
would suggest you write yourself a pow function...
long pow(long x,long y)
{
   long result=1;
   for(i=0;i<y;i++)
      {
      result*=x;
      }
   return result;
}

(sorry, no doubles, forgot how to do the decimals);
______________________________ Reply Separator _________________________________
I've implemented a level system on my mud that use a formula to compute
the exp points needed to raise levels. But, to use the pow() function i
have to #include the <math.h> header... that already have a log()
function, and the mud have the log system... right, I just declare the
prototype of the func ( double pow( double x, double y) ) and all right.
This in a Win95 with cygnus compiler (ack).

But when i'm porting the code to a linux box, the damn thing tells me
that pow() is a undefined reference... any clue for this? (This in two
different machines, one with the slackware distribution and other with
Red Hat, both with GCC.

Any help would be appreciated, and sorry about the english... :)


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST