the problem that i am seeing is that you are trying to compile a c program but you are writing a c++ program you woudlnt use gcc you would use something else i cant think of it off the top of my head if i come up with it later i will post it. and another thing you mite want to save the file as .cpp that mite help you out there too.
edit. well i think the command for compiling a c++ program would be g++ but im not sure i didnt run the command to check but try that out and see what you get

good luck