According to
http://en.cppreference.com/w/cpp/string/basic_string/stol, std::stoi is part of <string>, but when I try to compile the following code:
#include <iostream>
#include <string>
int main()
{
std::string str1 = "45";
std::string str2 = "3.14159";
std::string str3 = "31337 with words";
std::string str4 = "words and 2";
//The error occurs on the next line
int myint1 = std::stoi(str1);
int myint2 = std::stoi(str2);
int myint3 = std::stoi(str3);
std::cout << "std::stoi(\"" << str1 << "\") is " << myint1 << '\n';
std::cout << "std::stoi(\"" << str2 << "\") is " << myint2 << '\n';
std::cout << "std::stoi(\"" << str3 << "\") is " << myint3 << '\n';
}
I get the error "error: 'stoi' is not a member of 'std'"
I did some Googling and found that I apparently need the -std=c++11 flag to enable this feature, but I have this checkbox checked in my GNU GCC Compiler page, as follows:
Can anybody shed some more light on this issue for me please?
Using Code::Blocks 12.11 with mingw32-gcc (tdm-1) 4.7.1