www.digitalmars.com         C & C++   DMDScript  

c++ - std::sqrt() with a double argument gives an error

reply =?ISO-8859-1?Q?=22Sz=2E_Horv=E1t=22?= writes:
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?

Sep 01 2007
next sibling parent =?ISO-8859-1?Q?=22Sz=2E_Horv=E1t=22?= writes:
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
prev sibling parent eros <asdf asdf.no> writes:
use return 0;
Mar 22 2009