PDA

View Full Version : For loop error



silur
24th August 2012, 16:02
hi i'm getting a very funny and frustrating error in QT here is my simple code:


for (int i=0; i<=10;i++);
{
qDebug() << i;

}

and my error :
error: name lookup of 'i' changed for ISO 'for' scoping

this error happens if i try to use the variable OUTSIDE the for loop but.... u see :D

spirit
24th August 2012, 16:32
Remove ";" after loop declaration


for (int i=0; i<=10;i++); //<---- remove ";"
{
qDebug() << i;

}