help for math fuctions

Blake Huff stangmechanic@gmail.com
Sun Feb 25 15:11:00 GMT 2007


Walter:

You need to pass the '-lm' flag to the linker telling the linker to  
link the math library, I believe.   See if that doesn't work for ya.


"Hats and mittens you kittens!"

Blake Huff
stangmechanic@gmail.com





On Feb 25, 2007, at 6:19 AM, Walter Kasberg wrote:

> I have problems to use some math functions like 'pow' or 'log10'.
>
> I am using 'gcc-4.1.1-3mdk' from Mandrake.
> I have a main program 'tatm.c' and a subroutine 'atm.c' where the math
> funstions are used.
> In 'atm.c' i have defined
> #include<math.h>
>
> My makefile is:
> -------------------------
> OBJ = tatm.o atm.o
>
> .f.o:
>         gcc -c  $<
>
>
> tatm : $(OBJ)
>         gcc $(OBJ) -o tatm
> ---------------------------------
> if I try 'make' compiling works but from linker I get the message:
>
> 'atm.c:(.text+0xf5): undefined reference to `pow'
> collect2: ld returned 1 exit status
> make: *** [tatm] Fehler 1'
>
> What could be wrong or missing?
>
> Any hit or help is appreciated.
>
> Walter Kasberg
>
> Besides:
> With Win2000 (gcc-3.4.5 and mingw) it works.



More information about the Gcc-help mailing list