I am trying to compile the two files below, but I get an error message from the compiler: gcc 4.3.3 (Linux)
Error in line signed with: LINE WITH ERROR
What am I doing wrong, how can I change it?
Louis ...............................
$ g++ -c bh b.cpp b.cpp: In function 'void calcularDesempPop(std::vector<Individuo, std::allocator<Individuo> >&)': b.cpp:19: error: name lookup of 'iter' changed for new ISO 'for' scoping b.cpp:17: error: using obsolete binding at 'iter'
............................... FILE: b.cpp
#include <iostream> #include <algorithm> #include "desempenho.h" using std::cout; using std::endl; struct Individuo { vector<double> vec; double desempenho; }; void calcularDesempPop(vector<Individuo>& pop) { for (vector<Individuo>::iterator iter = pop.begin(); iter != pop.end(); ++iter);//LINE WITH ERROR iter->desempenho = calcularDesempenho(iter->vec); cout << endl; }
............................... FILE: bh
#ifndef GUARD_populacao_h #define GUARD_populacao_h //#include <algorithm> #include <iostream> #include "cromossoma.h" struct Individuo { vector<double> vec; double desempenho; }; void calcularDesempPop(vector<Individuo>& pop); #endif
source share