I am making a small vocabulary remembering program where words would would be flashed at me randomly for meanings. I want to use standard C++ library as Bjarne Stroustroup tells us, but I have encountered a seemingly strange problem right out of the gate.
I want to change a long
integer into std::string
so as to be able to store it in a file. I have employed to_string()
for the same. The problem is, when I compile it with g++ (version 4.7.0 as mentioned in its –version flag), it says:
PS C:\Users\Anurag\SkyDrive\College\Programs> g++ -std=c++0x ttd.cpp
ttd.cpp: In function 'int main()':
ttd.cpp:11:2: error: 'to_string' is not a member of 'std'
My program that gives this error is:
#include <string>
int main()
{
std::to_string(0);
return 0;
}
But, I know it can’t be because msdn library clearly says it exists and an earlier question on Stack Overflow (for g++ version 4.5) says that it can be turned on with the -std=c++0x
flag. What am I doing wrong?