mardi 8 janvier 2019

non-aggregate type 'vector

When trying to create a simple vector in C++

vector<int> month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

I get the following error :

non-aggregate type 'vector' cannot be initialized with an initializer list

I found out that it happens pre c++11. How do i install or get c++11 or c++17? Currently using eclipse and uploaded it like few weeks ago.

Also I found that its possible to pass to compiler g++ -std=c++11 prog.cpp but where do i put it on mac?

Aucun commentaire:

Enregistrer un commentaire