When posting code, please, please, please use code tags around it. If you don't know what the code tags are, there is a button labeled "Code" above the message reply/new thread text box. Click it and it will insert the tags for you.
Your problem lies with scoping. The only
place your code declares the variable is inside a for-loop:
for (int i = 0; i < stepsToTry; i = i + 1)
You later reference it outside the for loop with:
cout << "Waldo made it home after taking " << i << "steps!\n";
When declaring a variable like this, it only exists inside the for-loop. Some compilers accepted sloppy programming by letting the variable get referenced outside its scope. The warning you get from g++ says that the ISO standard now explicitly disallows use outside the for loop. The compiler will continue compiling the code by assuming the sloppy method should be used.
Either declare the variable outside the for loop, or reference a different variable in the cout statement to avoid the message.
Also, you have a mistake in one of your do-while loops:
double angle = 2*PI*rand()/RAND_MAX;
dx = cos(angle);
dy = sin(angle);
}while (atHome = 0);
The text in red is an assignment
not a comparison. That expression will always assign 0 to atHome and the expression will always evaluate to false.