I am writing a 3D tic tac toe program and have run into several errors. The first is:

[Error] name lookup of 'z' changed for ISO 'for' scoping [-fpermissive]

[Note] (if you use '-fpermissive' G++ will accept your code)

I have no idea what -fpermissive or G++ is or how to fix it.

Here is the code that pertains to that error:

Code:

int tdBoard::checkWinner()
{
for(int z = 0; z < 3; z++)
{
for(int x = 0; x< 3; x++)
{
if(((boardTwo[x][0][z] == 8)&&(boardTwo[x][1][z] == 8)&&(boardTwo[x][2][z] == 8))||
((boardTwo[x][0][z] == 9)&&(boardTwo[x][1][z] == 9)&&(boardTwo[x][2][z] == 9)))
{
if((boardTwo[x][0][z] == 8)&&(boardTwo[x][1][z] == 8)&&(boardTwo[x][2][z] ==8))
{
userScore++;
}
else
{
compScore++;
}
}
}
}
for(int y = 0; y < 3; y++)
{
if(((boardTwo[0][y][z] == 8)&&(boardTwo[1][y][z] == 8)&&(boardTwo[2][y][z] == 8))||((boardTwo[0][y][z] == 9)&&(boardTwo[1][y][z] == 9)&&(boardTwo[2][y][z] == 9)))
{
if((boardTwo[0][y][z] == 8&&(boardTwo[1][y][z] == 8)&&(boardTwo[2][y][z] == 8)))
{
userScore++;
}
else
{
compScore++;
}
}
}