Home > Article > Backend Development > Why Does `std::stoi` Not Exist in MinGW with gcc 4.6.1?
std::stoi Does Not Exist in MinGW
When compiling a program using std::stoi on MinGW with gcc 4.6.1, an error message may occur stating that "std::stoi is not a member of 'std'". This occurs despite the function's availability in newer versions of gcc.
The Cause:
MinGW's non-standard declaration of the vswprintf function defines the macro _GLIBCXX_HAVE_BROKEN_VSWPRINTF, which disables the conversion functions, including std::stoi.
Workaround:
Modify the header files included with MinGW by commenting out the macro on line 2754 of .../lib/gcc/mingw32/4.6.1/include/c /bits/basic_string.h. Additionally, add the macro back around lines 2905 to 2965, excluding the references to std::vswprintf. While this workaround enables the conversion functions, it prevents the use of std::to_wstring functions.
The above is the detailed content of Why Does `std::stoi` Not Exist in MinGW with gcc 4.6.1?. For more information, please follow other related articles on the PHP Chinese website!