name lookup of 'iter' changed for new ISO 'for' scoping
<p>I'm trying to compile the two files below, but get an error message from the compiler: gcc 4.3.3 (Linux)</p>

<p>The error is in the line signed with: LINE WITH ERROR</p>

<p>What I'm I doing wrong, how should I change it?</p>

<p>Luis
...............................</p>

<pre><code>$ g++ -c b.h b.cpp 
b.cpp: In function 'void calcularDesempPop(std::vector&lt;Individuo, std::allocator&lt;Individuo&gt; &gt;&amp;)':
b.cpp:19: error: name lookup of 'iter' changed for new ISO 'for' scoping
b.cpp:17: error:   using obsolete binding at 'iter'
</code></pre>

<p>...............................
FILE: b.cpp</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;algorithm&gt;
#include "desempenho.h"

using std::cout;
using std::endl;

struct Individuo {
    vector&lt;double&gt; vec;
    double desempenho;
};



void calcularDesempPop(vector&lt;Individuo&gt;&amp; pop) {
    for (vector&lt;Individuo&gt;::iterator iter = pop.begin();
                    iter != pop.end(); ++iter);//LINE WITH ERROR
        iter-&gt;desempenho = calcularDesempenho(iter-&gt;vec);
        cout &lt;&lt; endl;
}
</code></pre>

<p>...............................
FILE: b.h</p>

<pre><code>#ifndef GUARD_populacao_h
#define GUARD_populacao_h

//#include &lt;algorithm&gt;
#include &lt;iostream&gt;
#include "cromossoma.h"

struct Individuo {
    vector&lt;double&gt; vec;
    double desempenho;
};


void calcularDesempPop(vector&lt;Individuo&gt;&amp; pop);

#endif
</code></pre>
