错误是:
In function ‘int returnShortestWeightedBranch(std::vector<route,std::allocator<route> >*)’: error: name lookup of ‘jj’ changed for ISO ‘for’ scoping note: (if you use ‘-fpermissive’ G++ will accept your code)
代码是:
for (int i = 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); for (int jj = 0; jj < routeVector[i].selectedBranchesVector.size(); jj++); { cout << "\n-----------branch: " << routeVector[i].selectedBranchesVector[jj].connectedExitPoint; } } }
这里有什么问题?
编辑1:
我改变了以下几点:
for (int jj = 0; jj < routeVector[i].selectedBranchesVector.size(); jj++);
至:
int jj; for (jj = 0; jj < routeVector[i].selectedBranchesVector.size(); jj++);
现在正在工作!我不明白原因.