I compile my program in Linux - it has the following line:
std::sqrt((double)num);
On Windows, it is ok. However, on Linux, I get an error:
sqrt
is not a member ofstd
I have already included math.h
.
What is the problem with that?
Change the directive to #include <cmath>
. C++ headers of the form <cxxxxxxx>
are guaranteed to have the standard names in std
namespace (and may optionaly provide them in global namespace). <xxxxxx.h>
are not.