Home > Article > Backend Development > Why are std::stoi, std::stoul, and related functions not recognized in MinGW 4.6.1?
std::stoi Issue in MinGW 4.6.1
Upon attempting to compile a program utilizing std::stoi, std::stoul, and related functions with MinGW 4.6.1, an error is encountered indicating that these functions are not recognized as members of std. This issue arises due to the non-standard declaration of vswprintf on Windows platforms.
The GNU Standard Library sets the macro _GLIBCXX_HAVE_BROKEN_VSWPRINTF, which disables the conversion functions used. This macro effectively disables the conversion functions used. For an in-depth understanding of the issue, refer to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37522.
To address this issue, users may modify the header files distributed with MinGW. This can involve removing the !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF) macro from 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, which reference std::vswprintf. This modification will enable the availability of conversion functions, excluding std::to_wstring functions.
The above is the detailed content of Why are std::stoi, std::stoul, and related functions not recognized in MinGW 4.6.1?. For more information, please follow other related articles on the PHP Chinese website!