Home >Backend Development >C++ >Why Does g (MinGW) Report 'to_string Not Found in std,' and How Can I Fix It?
to_string Not Found in std, Says g (Mingw)
Problem Statement
When compiling a C program that uses std::to_string() with g (MinGW 4.7.0), the compiler generates an error, stating "to_string is not a member of std."
Cause
This is a known bug in MinGW versions prior to GCC 4.8.0, specifically with the C 0x standard mode.
Solution
There are two main solutions to this issue:
1. Apply a Patch
Visit the bug report provided on Bugzilla (link in the provided answer) and download the patch to update MinGW. Install the patch and recompile your program.
2. Use an Updated MinGW Distro
Use a MinGW distro that supports GCC versions above 4.8.0. The following distros are known to have this issue resolved:
Install the updated MinGW distro and compile your program again.
Additional Notes
The above is the detailed content of Why Does g (MinGW) Report 'to_string Not Found in std,' and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!