Undefinced reference to 'pow'

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I'm trying to include the math function 'pow' in my code but I get the following error message.

-Undefined reference to 'pow'

I''ve tried to add the -lm parameter to the linker to fix this problem, but it doesn't work. The math.h is added as well.

Anybody knows how to solve this?

Cheers
Gert

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GertJ wrote:

I''ve tried to add the -lm parameter to the linker to fix this problem, but it doesn't work. The math.h is added as well.

Are you calling avr-gcc or avr-ld to do your linking?

If you use the WinAVR Makefile Template, or use MFile to generate your makefile then you shouldn't have any problems with linking in the math library.