为什么我不能在linux中的代码块中使用"auto"

0 c++ linux codeblocks auto

这是我第一次auto在c ++中使用,我在linux上工作,但我发现它根本不起作用.我想知道发生了什么.这是我的代码:

    //<STL container.cpp>
    //date: 2014.3.9 10:45
    #include<iostream>
    //#include<iterator>
    #include<vector>
    using namespace std;
    int main()
    {
        double a= 10.0;
        auto b=a;
        cout<<b;
        //for(auto it = mydata.begin();;it!=mydata.end();it++)
           // cout<<" "<<*it;
        cout<<endl;
        return 0;
    }
Run Code Online (Sandbox Code Playgroud)

和代码块告诉我:

error:'b' does not name a type
error:'b' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)

我想知道codeblocks是不引用auto还是linux不引用.

小智 5

有关如何在CodeBlock上启用C++ 11模式的信息,请参阅此图像.

在此输入图像描述