SQRT in stm32f4 ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-06-03 6:06 AM
Posted on June 03, 2013 at 15:06
Hello
I want to use sqrt (square root
) function to calculate sqrt (x^2 + y^2) but i haven't math.h in my root this is the errorundefined reference to `sqrt'
collect2: ld returned 1 exit status how can i fix it please or are there an approximation of this function. Thanks :) #lmgtfy
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-06-03 6:34 AM
Posted on June 03, 2013 at 15:34
Include files don't pull in code, you must link against a suitable C math library. Consider using the ''-lm'' option for the compiler, which should pull in libm
Also consider sqrtf(), this at least might have some chance of using the FPU.http://www.embedded.com/electronics-blogs/programmer-s-toolbox/4219659/Integer-Square-Roots
Might I also recommend Google or Bing as an effective tool for discovering the wealth of information on the internets.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
