Thread overview
std::sqrt() with a double argument gives an error
Sep 01, 2007
Sz. Horvát
Sep 01, 2007
Sz. Horvát
Mar 22, 2009
eros
September 01, 2007
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
September 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.
March 22, 2009
use return 0;