#include <iostream>
using namespace std;
int main ()
{
int i = 2, a = 4;
auto b = 10 ;
cout << b << endl;
}
例如使用auto時
編譯器報錯
往往是編譯時 編譯器沒有開啓C++11支持
解決方法:
在編譯選項中,勾選“在編譯時加入以下命令”
加入-std=c++11
ok,問題解決!
#include <iostream>
using namespace std;
int main ()
{
int i = 2, a = 4;
auto b = 10 ;
cout << b << endl;
}
例如使用auto時
編譯器報錯
往往是編譯時 編譯器沒有開啓C++11支持
解決方法:
在編譯選項中,勾選“在編譯時加入以下命令”
加入-std=c++11
ok,問題解決!