What up with std::sqrt()?

Started by
2 comments, last by Lillemanden 20 years, 1 month ago
Hey. I''m trying to use std::sqrt(), I have tried both #include <cmath> #include <math.h>. I don''t get any error such file not found, but when I try to compile anything with std::sqrt() in it I get a "error C2039: ''sqrt'' : is not a member of ''std''". I''m using VC++ 6. I of cause have a number inside the (). VC++ 6 will however in the list of std members (showing as soon as I write the second '':'') show "sqrt".
Advertisement
VC++6 had a bug in its standard library where functions such as sqrt(), that were supposed to be in the std namespace, weren''t. Just use the one from the global namespace.

"Sneftel is correct, if rather vulgar." --Flarelocke
ahh, thank you.
You can hack around it by doing something like

namespace std{using ::sqrt;}


in the cmath header

This topic is closed to new replies.

Advertisement