std::stoi doesn’t exist in g++ 4.6.1 on MinGW

This is a result of a non-standard declaration of vswprintf on Windows. The GNU Standard Library defines _GLIBCXX_HAVE_BROKEN_VSWPRINTF on this platform, which in turn disables the conversion functions you’re attempting to use. You can read more about this issue and macro here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37522.

If you’re willing to modify the header files distributed with MinGW, you may be able to work around this by removing the !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF) macro on line 2754 of .../lib/gcc/mingw32/4.6.1/include/c++/bits/basic_string.h, and adding it back around lines 2905 to 2965 (the lines that reference std::vswprintf). You won’t be able to use the std::to_wstring functions, but many of the other conversion functions should be available.

Leave a Comment