Roh*_*ain 2 c++ c++11 ubuntu-12.04 g++4.8
我有这个简单的代码:
#include <string>
#include <iostream>
using namespace std;
int main() {
string s1 = "rohit";
auto len = s1.size();
cout << len;
}
Run Code Online (Sandbox Code Playgroud)
当我在Ubuntu 12.04上编译此代码时,它显示以下错误:
test.cc: In function ‘int main()’:
test.cc:8:10: error: ‘len’ does not name a type
auto len = s1.size();
^
test.cc:10:13: error: ‘len’ was not declared in this scope
cout << len;
^
Run Code Online (Sandbox Code Playgroud)
我有g ++ 4.8.1.auto在g ++ 4.8.1中使用关键字是否有一些变化?
| 归档时间: |
|
| 查看次数: |
1344 次 |
| 最近记录: |