Possible Duplicate:
How to convert a number to string and vice versa in C++
I am using Qt Creator 2.5.0 and gcc 4.7 (Debian 4.7.2-4). I added "QMAKE_CXXFLAGS += -std=c++11" to .pro file. Everything seems to be OK, I used C++11 std::for_each and so on. But when I included "string" header and wanted to use stoi, i got the following error:
performer.cpp:336: error: 'std::string' has no member named 'stoi'
I found some questions related to MinGW and one more, to Eclipse CDT and they had their answers. But I use Linux, why it is NOT working here?
or
look at http://en.cppreference.com/w/cpp/string/basic_string/stol
std::stoi
is a function at namespace scope, taking a string as its argument:From the error message, it looks like you expect it to be a member of
string
, invoked ass.stoi()
(or perhapsstd::string::stoi(s)
); that is not the case. If that's not the problem, then please post the problematic code so we don't need to guess what's wrong with it.