0

I'm trying to use stoi function with MinGW 4.8.1 but it says that "stoi is not defined in this scope". I got C++11 support checked in both project and compiler settings. Here are the build commands:

mingw32-g++.exe -std=c++11 -Wall -fexceptions -std=c++11 -std=c++11 -g -std=c++11  -c

1 Answers1

0

I tested this in my MinGW 4.8.1 installation and, indeed, stoi() is not recognized, for whatever reason. However, its functionality can be easily replaced using strtol(), which does work fine in 4.8.1. Of course, the parameter types are somewhat different between the two functions, but the differences can be accounted for trivially. Please see documentation for the two functions.

Anatoli P
  • 4,791
  • 1
  • 18
  • 22