error C2065: 'i' : undeclared identifier
I have some code written in visual C++ v6 and I'm trying to build it in
visual studio 2005. The conversion process went ok, but when I try to build
it says -
error C2065: 'i' : undeclared identifier
This is the function where the error occurred -
///////////////////////////////////////
void _xListCtrl::OnLButtonDown(UINT nFlags, CPoint point){
CPoint pt;
GetCursorPos(&pt);
ScreenToClient(&pt);
LVHITTESTINFO hti;
hti.pt=pt;
SubItemHitTest(&hti);
int item=GetTopIndex();
int iSub;
int ic=GetCountPerPage();
BOOL bFound=FALSE;
CRect rc;
for(int i=item;i<item+ic;i++){
if(!hti.iSubItem){
GetItemRect(i,&rc,LVIR_BOUNDS);
if(!PtInRect(rc,pt)) continue;
CRect rc2;
GetSubItemRect(i,1,LVIR_BOUNDS,rc2);
iSub=1;
rc.right=rc2.left;
}
else{
GetSubItemRect(i,hti.iSubItem,LVIR_BOUNDS,rc);
iSub=hti.iSubItem;
}//if()
if(PtInRect(rc,pt)){
bFound=TRUE;
break;
}//if()
}//for()
if(!bFound) return;
StartItemEdit(rc,i,iSub); <------------------error occurs here-----
}//OnLButtonDown()
///////////////////////////////////////
Any ideas what the cause is, or how to fix it? I have tried putting INT i;
at the top with the others but it makes no difference. Sorry if it's really
obvious, but I'm just learning...
Thanks.