c++ programs normaly have an extension of .cpp. What's the name of the program you are trying to compile? Data.txt seems to be a text file that is used by the program. Somehow VS seems to think it should compile this. It may be that's it's got part of the solution that VS is trying to compile. In VS you should have a Solution Explorer window. In this window you should see a tree of the solution you are trying to produce. Under the branch source files you should see the name of the program you are trying to compile. You should not see data.txt here. If you do, then remove it (but don't delete the file). You should also see branches for header files and resource files etc. gain, data.txt should not appear here. The code you supplied compiles without error so somehow the complier is trying to complile your data.txt file. If you can't see this file name in the soultion explorer, try looking in properties of the project. Somwhere you're told VS to treat data.txt as a source file.

Hope this helps but trying to work out an issue with the complier is sometimes harder than debugging code!