need help with c++11

I installed new GCC compiler, thinking it will let me work with C++11.
Now when I try to run a code containing stoi it says that "stoi was not declared in this scope". What do I have to do so it works? I checked -std=c++11 , too.
My first guess would be that you may be missing an std:: or something, but you may want to post your code.
Don't have issue with version 4.8.0
¿have you included the `string' header?
Firstly, this code wasn't made by me, this was made by Yanson. I just wanted to compile it, but it doesn't work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main()
{
    string x; int digit; int t=0;
	string temp;

    vector<int> digitstack;
    getline(cin, x);
    
	for(int i = 0; i < x.length(); i++)
    {
        temp = x.at(i);
		digit = stoi(temp);
		digitstack.push_back(digit);
    }

    sort(digitstack.begin(), digitstack.end());

        while(t!=digitstack.size())
    {
        cout << digitstack[t] << " "; t++;

    }

	cin.ignore();
	return 0;
}
I think I'm using 4.7.1 version, but I don't think that's too old
I can compile it fine with 4.8.0

By the way, that code is overkill.
Topic archived. No new replies allowed.