My guess is that you created a project, deleted the code given by the project template and replaced it with the above. If the is a correct assumption it is likely that you have removed the include file used for pre-compiled headers. The easiest way to check this is to put #include <stdafx.h> on the the top line of your code and rebuild.
If this does not work, instead of saying yes to the "there were build errors... " dialog, say no and go back to VS, click on the error list tab at the bottom and report back here what the errors are.