I had been using Cygwin + NetBeans till now and today I found out that I was using an outdated version of GCC (3.4.4) so I updated to GCC 4.7.2 by installing MinGW. After doing that, I wrote this piece of code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
#include <vector>
using std::vector;
int main()
{
vector<int> v{1,2,3,4,5,6,7,8,9};
for(auto &i : v)
i*=i;
for(auto i : v)
std::cout << i << " ";
std::cout << '\n';
return 0;
}
I get loads of errors in this program. Some of them are:
warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
error: in C++98 'v' must be initialized by constructor, not by '{...}'
I am also getting errors in the included header files. I have enabled NetBeans to use MinGW instead of Cygwin and I have set the Path to C:/MinGW/bin. Any ideas about what the problem might be ?