PDA

View Full Version : Math functions missing?



alive
May 30th, 2005, 11:14 AM
Hello,

I wasn't able to compile a small program because of an undefined reference to pow(). I tested and it doesn't seem any of the functions in math.h (sin(), etc) are available to my program. Since these are part of the C standard library I'm quite surprised.

What do I have to do to get math functions working? I tried using -lmath, but that didn't work.

Thanks

Juergen
May 30th, 2005, 11:43 AM
Try '-lm', the library is named 'libm'

alive
May 30th, 2005, 11:50 AM
Ah, thank you. I've been developing with gcc on ******* (MinGW) for awhile, so I wasn't used to having to link with something to get part of the standard library. That cleared it up!