I have Eclipse Juno C ++ (Build id: 20120614-1722). I am trying to set the arguments to the compiler with the instruction -std = C ++ 11 or -std = C ++ 0x, but when compiling the code below. In Eclipse Juno (at least for Mac) there are no "tool settings", so I can not go to "C / C ++ Build β Settings β Settings". My compiler is 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; }
I got:
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
source share