c++ - std::sqrt() with a double argument gives an error
- =?ISO-8859-1?Q?=22Sz=2E_Horv=E1t=22?= Sep 01 2007
- =?ISO-8859-1?Q?=22Sz=2E_Horv=E1t=22?= Sep 01 2007
- eros <asdf asdf.no> Mar 22 2009
The following code gives an error:
#include <cmath>
int main() { std::sqrt(10.0); }
int main() { std::sqrt(10.0); }
^
Error: ambiguous reference to symbol
Had: std::_inline_sqrt(float )
and: std::_inline_sqrt(long double )
--- errorlevel 1
It works fine if I use sqrt() instead of std::sqrt(), or if I use a
float or long double value, e.g. std::sqrt(10.0f)
I have stared at math.h for some time but I could not figure out what
the difference between std::sqrt() and sqrt() is (or where std::sqrt()
is defined).
Could someone please take a look at this and show me what to change in
the library headers to make it work?
Szabolcs
Sep 01 2007
OK, I'm stupid, I should have looked at STLport's cmath, not at dmc's. I also found the previous posts about this.
Sep 01 2007









=?ISO-8859-1?Q?=22Sz=2E_Horv=E1t=22?= 