struct - C++: unimplemented: non-static data member initializers -
struct - C++: unimplemented: non-static data member initializers -
i have next code:
#include <fstream> #include <iostream> #include <algorithm> #include <vector> using namespace std; struct node{ vector<int> vic; bool visitato = false; }; int main (){ vector<node> grafo; ifstream in("input.txt"); int n, m, s, from, to; in >> n >> m >> s; grafo.resize(n); (int = 0; < m; i++){ in >> >> to; grafo[from].vic.push_back(to); } (int = 0; < grafo.size(); i++) for(int j = 0; j < grafo[i].vic.size(); j++) cout << "from node " << << " node " << grafo[i].vic[j] << endl; }
and (on ubuntu) type next command:
/usr/bin/g++ -deval -static -o2 -o visita visita.cpp -std=c++0x
and next error:
visita.cpp:10:21: sorry, unimplemented: non-static info fellow member initializers visita.cpp:10:21: error: iso c++ forbids in-class initialization of non-const static fellow member ‘visitato’
at home works fine here in university doesn't. command executed has been posted our teacher. why doesn't work in uni in home?
non static info fellow member initializers available since gcc 4.7. so, check gcc version.
c++ struct compiler-errors non-static
Comments
Post a Comment