to_string is not a member of std, says g++ (mingw)
c++, c++11, g++, mingw, tostring
Solution
This is a known bug under MinGW. Relevant Bugzilla. In the comments section you can get a patch to make it work with MinGW.
This issue has been fixed in MinGW-w64 distros higher than GCC 4.8.0 provided by the MinGW-w64 project. Despite the name, the project provides toolchains for 32-bit along with 64-bit. The Nuwen MinGW distro also solves this issue.
Problem
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?