Problems with std::stoi, not working on MinGW GCC 4.7.2

It seems your MinGW needs a patch: Enabling string conversion functions in MinGW

This patch enables the following list of C++11 functions and templates
in the std namespace:

stoi, stol, stoul, stoll, stof, stod, stold,
to_string, to_wstring

In above link, there is a .zip file, download it and

  • Copy wchar.h and stdio.h from the include directory in the zip file
    to the following directory (overwrite): C:\mingw\include (replace
    C:\mingw\ with the appropriate directory)
  • Copy os_defines.h to the following directory (overwrite):
    C:\mingw\lib\gcc\mingw32\4.7.0\include\c++\mingw32\bits (replace
    C:\mingw\ with the appropriate directory) (replace 4.7.0 with the
    correct version number)

Leave a Comment