Error with vectors

I'm writing a simple peace of code using vector just to check it out and I already get an error I don't understand.

1
2
3
4
5
6
7
8
#include <iostream>
#include <vector>

int main(void)
{
    std::vector<int> V{0,1};
    return 0;
}

It says "error: in C++98 'V' must be initialized by constructor, not by '{...}'"
And a "warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]". What's going on? I'm using Code:Blocks 13.12.
Last edited on
Go to your compiler options and look for a compiler flag that turns on C++11 features.
Or just manually add -std=c++11 to the compiler options yourself.
Topic archived. No new replies allowed.