code seems to work fine, copied, pasted, compiled and run. Just outputs the message, by the way you don't actually need the namespace for your program as your only using cout anyway.
All I can think is that the file contains a premature EOF which your editor doesn't display.
Why don't you upload it or post it as base64?
While you're at it, post the command you're using to compile.
Something tells me that that's a C compiler (although I tried compiling a C++ source with gcc and got a different error message).
How about g++ test.cpp?
You are using Linux, right? Or maybe BSD?