无法使用std = c ++ 11设置Eclipse Juno C++

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)

Car*_*ner 5

你可以按照我在这个答案中描述的步骤: Eclipse CDT C++ 11/C++ 0x支持

一种可能性是,您的选项适用于工具链的错误部分.