initializing vector

Using g++ 4.8.1 as compiler with -std=c++11 in the args for the compiler and linker, I used the following as the first line of main():
vector<double> data = {1, 2, 4};
This is as I understand valid syntax for c++11 but the compiler error tells me: means.cpp:36:34: error: in C++98 'data' must be initialized by constructor, not by '{...}'
vector<double> data = {1, 2, 4};
^
means.cpp:36:34: error: could not convert '{1, 2, 4}' from '<brace-enclosed initializer list>' to 'std::vector<double>'

You must have done something wrong when you passed -std=c++11 to the compiler because the error message mentions C++98.
The error line says the compiler is working in "C++98" mode. Check the compiler arguments again.

The linker doesn't care what standard you are using.
The '-std=c++11' argument was in ARGS2 (JGrasp compiler settings). I resolved this by moving it to ARGS1 with a space after '-Wall'.
Topic archived. No new replies allowed.