www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



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

↑ ↓ ← =?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?

Szabolcs
Sep 01 2007
↑ ↓ → =?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