Rom*_*gan 6 c++ eclipse compiler-errors c++11 eclipse-juno
我有Eclipse Juno C++(Build id:20120614-1722).我正在尝试使用指令-std = c ++ 11或-std = c ++ 0x设置编译器调用参数,但在编译下面的代码时.Eclipse Juno中没有"工具设置"(至少对于Mac),所以我不能进入"C/C++ Build - > Settings - > Tool Settings".我的编译器是GCC 4.8.0
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main(void) {
vector<string> v = {"a","b","c"};
for(string s: v){
cout << s << endl;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我有:
HelloWorld.cpp:16:33: error: could not convert ‘{"a", "b", "c"}’ from ‘<brace-enclosed initializer list>’ to ‘std::vector<std::basic_string<char> >’
HelloWorld.cpp:17:16: error: range-based ‘for’ loops are not allowed in C++98 mode
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9737 次 |
| 最近记录: |