Range Based For Loop in GCC 4.6.3

Hi Folks,
I am a beginner in C++ and would like to try out a range based for loop. I am using gcc 4.6.3. According to the link below, gcc 4.6.3 should allow me to use a range based for loop.


However when attempting to run the code below, my IDE (Eclipse) reports the following error:

"error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options:

int a[5] ={1,2,3,4,5};

for (int x : a)

If gcc 4.6.3 supports range based for loops why do I get this error?


You must compile with the C++0x flag.
Topic archived. No new replies allowed.