这个bfs的代码,将弹出队列的语句放在while为什么vs2013运行到一半会报错,但是dev不会

bool bfs()
{
queue

pp;
pp.push(p(sx, sy));
bj[sx][sy] = 0;
zx[sx][sy] = -1;//起点处的转弯次数为-1,这样走出的第一步转弯次数为0
zhuangtai[sx][sy] = p(1000, 1000);
while (pp.size())
{
int x = pp.front().first;
int y = pp.front().second;
pp.pop();//这个弹出语句
return true;
}
int a[4] = { 0, 0, 1, -1 }, b[4] = { 1, -1, 0, 0 };
int i;
for (i = 0; i < 4; i++)
{

        int tempx = x + a[i];
        int tempy = y + b[i];
        if (migong[tempx][tempy] == '.' && 0 <= tempx&&tempx < n && 0 <= tempy&&tempy < m)
        {
            zhuangtai[tempx][tempy] = p(tempx - x, tempy - y);
            if (p(tempx - x, tempy - y) != zhuangtai[x][y])
            {
                if (zx[tempx][tempy]<zx[x][y] + 1)
                    continue;
                zx[tempx][tempy] = zx[x][y] + 1;
                pp.push(p(tempx, tempy));
            }
            else
            {
                if (zx[tempx][tempy] < zx[x][y])
                    continue;
                zx[tempx][tempy] = zx[x][y];
                pp.push(p(tempx, tempy));
            }
        }
    }

}
return false;

}图片说明

http://www.tubaobei.com/gongzuozongjie/201610742110.html