c++ - Error message: name lookup of ‘jj’ changed for ISO ‘for’ scoping, (if you use ‘-fpermissive’ G++ will accept your code) -


the error is:

in function ‘int returnshortestweightedbranch(std::vector<route, std::allocator<route> >*)’: error: name lookup of ‘jj’ changed iso ‘for’ scoping note: (if use ‘-fpermissive’ g++ accept code) 

the code is:

for (int = 0; i< routevector.size(); i++)         {             if (routevector[i].exitpoint == exitpointdetailsvector[preservel].exitpoint)             {                 cout << "\n-----------parent: " << routevector[i].exitpoint;                 branch obj;                 obj.connectedexitpoint = exitpointdetailsvector[preservei].exitpoint;                 routevector[i].selectedbranchesvector.push_back (obj);                  (int jj = 0; jj < routevector[i].selectedbranchesvector.size(); jj++);                 {                     cout << "\n-----------branch: " << routevector[i].selectedbranchesvector[jj].connectedexitpoint;                 }             }         } 

what can problem here?

edit 1:

i changed following:

for (int jj = 0; jj < routevector[i].selectedbranchesvector.size(); jj++); 

to:

int jj; (jj = 0; jj < routevector[i].selectedbranchesvector.size(); jj++); 

and working!! fail understand reasons.

you have semicolon @ end of inner statement. ends scope of jj there, not visible inside block.

edit
have solved scope problem, still have loop executing just

<nothing>; 

remove semicolon after parenthesis!


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -