To keep the window running you need to have a "main loop", a loop that keeps the program running. If you leave the main method your program ends. From the tutorial code it's this snippet:
bool quit = false;
//While the user hasn't quit
while( quit == false )
//While there's events to handle
while( SDL_PollEvent( &event ) )
//If the user has Xed out the window
if( event.type == SDL_QUIT )
//Quit the program
quit = true;
Well, you seem to have simply copy/pasted a few lines of code out of the working tutorial code.
Your main issue right now seems to be to read errors properly.
The filename. You pasted a few lines from a function, which had parameter as a function argument. Obviously that argument is not here, so you have to declare filename yourself above the location where you access it. The compiler simply doesn't know what "filename" is (Hint: In the tutorial code it's a std::string)
apply_surface is the same. It's a function defined in the tutorial code. You only copied lines calling that function. The compiler obviously does not know the function.
Simple solution: Copy also the apply_surface function and paste it above the main function.
Note however forward declaration only works if the compiler doesn't need to know anything of the inner parts of that class. This means you can only forward declare pointers or references, not direct objects.
Visual Studio can nicely be uninstalled, but you need to use the main setup for this. Do NOT try to uninstall it's dependencies on your own. It will take care to remove the installed dependencies fine.
I had VS 2003, VS 2008 and VS 2010 installed (in that order). Then I uninstalled VS 2003 without problems, with VS 2008 and VS 2010 still working fine.
You're probably better off doing it some other way than reading back memory from the card. Aside from totally botching your frame rate the z buffer values are not directly usable. AFAIK the z value is not stored linearly.