2013-06-03 06:06 AM
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
2013-06-03 06:34 AM
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.