Hi,

I have a global variable
Game * game;

in main I have game = new Game();

and I have another function which monitors the progress of the game and if the current level is completed then I want to do game = new Game() again to start a new game but I want to clean up the heap so I do the following:

Code:
void Timer(int extra)
{
	...
	game->detectColisions();
	if (game->detectLevelCompleted())
	{
		if (game->level < 50)
		{
			delete game;
			game = new game();
		}
		else
			cout << "you beat the game congrats" << endl;
		//display menu
	}
	...
	glutPostRedisplay();
	glutTimerFunc(30,Timer,0);
}
but it won't compile. I'm using VC++ and I get the following compiler error:
error C2061: syntax error : identifier 'game'

Is this because I'm using a global variable?
I did something similar to pointers to characters instead of game but the pointer was a member and not global. Can Game * game not be a global variable if I want to delete it and reassign it as I showed above?