Home >Backend Development >C++ >Why Doesn't My MinGW g Compiler Recognize the `to_string()` Function?
to_string Function Not Recognized in g with MinGW
Problem:
When attempting to use the to_string() function from the standard C library in a program, an error is encountered: "'to_string' is not a member of 'std'." This occurs despite using the -std=c 0x flag to enable C 0x features.
Cause:
This is a known bug specific to MinGW implementations of g .
Solution:
Option 1: Update MinGW
The issue has been resolved in MinGW-w64 distributions higher than GCC 4.8.0 or in Nuwen MinGW. Upgrade to one of these versions.
Option 2: Apply a Patch
A patch can be found in the comments section of this Bugzilla report: https://sourceforge.net/p/mingw/bugs/1735/
Details:
The to_string() function is defined in the
Applying the patch or updating to a newer MinGW version will resolve the issue and allow you to use the to_string() function.
The above is the detailed content of Why Doesn't My MinGW g Compiler Recognize the `to_string()` Function?. For more information, please follow other related articles on the PHP Chinese website!