Re: math.h

From: Ronny Iversen (ronnyi@ifi.uio.no)
Date: 11/29/98


Christian Loth wrote:

> Give the compiler also the option: -lm.
> Because: the math.h just gives the function prototypes...but what
> the compiler really needs, the symbols of the library, are in libm.a,
> which you need to link with the above option.
>
> Ronny Iversen wrote:
> > #include <stdio.h>
> > #include <math.h>
> > /*test.c*/
> >
> > void main(void) {
> >   sprintf("%ld\n", pow(2,2));
> > }
> >
> > When I compile this with gcc test.c I get the following errors, anybody knows
> > whats wrong?
> > Im using redhat 5.1
> > /tmp/cca136931.o: In function `main':
> > /tmp/cca136931.o(.text+0x12): undefined reference to `pow'
> >
>
> - Chris
>

Tnx :) One more questions though..any idea where in Circlemuds makefile i should
put this -lm?

Noc

--
--------------- Codito, ergo sum - "I code, therefore I am" --------------------

http://birk113.studby.uio.no                                   ronnyi@ifi.uio.no

---------------- In a world without fences, who need gates? --------------------


     +------------------------------------------------------------+
     | 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/15/00 PST