Computer Science Canada undefined reference to `sqrt' |
Author: | DtY [ Thu May 07, 2009 8:49 pm ] | ||
Post subject: | undefined reference to `sqrt' | ||
So I wrote a function to calculate the distance between two points (using Pythagorean theorem), but when I compile it tells me undefined reference to `sqrt'
I'm guessing that pow() seeing the power as 1/2 calls sqrt, but why wouldn't sqrt be defined? |
Author: | Analysis Mode [ Thu May 07, 2009 9:01 pm ] |
Post subject: | Re: undefined reference to `sqrt' |
I can't really make heads or tails of what it's saying, but here's a link |
Author: | DtY [ Thu May 07, 2009 9:12 pm ] |
Post subject: | RE:undefined reference to `sqrt\' |
Oh thanks, seems I have to add -lm to the linker command if I want to use the math library. Thanks |