You need to read the error more carefully.
It says it is possible, but only using the new standard C++11 (also called c++0x).
You need to compile using the "std" flag:
g++ --ansi -Wall -Wextra -std=c++0x -o test main.cpp
As far as I recall, indeed you used to have to initialise arrays using a for loop.
If you're going to use C++11 anyway - consider using std::array instead of the old style arrays, they provide more protection against buffer overflows.
@JLBorges Thanks very much for that, I was unaware that initializer lists could be used in this way - although the name actually kind of gives it away, I only thought of it in the context of the uniformity.
@metulburr Yes that is still C++11 code, I think in C++98 you are stuck with the for-loop solution.
Kind of a noob question but: Does it matter which you compile any code as c++11, or c++98, will it run in the end on other computers? I still dont quite understand the the process from code to open source to others being able to compile the programs also.
C++11 is standard now, the 11 stands for 2011, when it became the standard.
Compiling C++ code could be the most easily explained by saying that the compiler actually translates your C++ code into machine code, which is code which the CPU understands and runs.
Once "translated", this code will run on any processor supporting the same machine code.
This is why you'll find different downloads for the same programs for different processor architectures (a linux distribution for instance). These processors support different machine code languages (called instruction sets), so the C++ code needs to be translated to each of those different languages.
It's kind of like making a website which you want to be understood by many languages. It's not good enough to translate it to one language, because still not everyone will understand it.