这是我第一次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不引用.
| 归档时间: |
|
| 查看次数: |
3306 次 |
| 最近记录: |