Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Hello Friends, can anybody explain me what is the error in this procedure of compiling and executing a c++ program file. enter image description here compiling and executing

share|improve this question
OFF TOPIC ... What terminal window are you using? – Phorce Oct 29 at 11:03

2 Answers 2

If you haven't specified the name of the executable to produce with -o NAME, it will be called a.out, rather than the same name as the source file.

So either do:

g++ program.cpp -o program


g++ program.cpp
share|improve this answer
command for executing the a.out file? – grv.giit Jan 4 '13 at 15:01
thanks this solved my issue!! – grv.giit Jan 4 '13 at 15:33

If you type
g++ progname.cpp

then it will create a file named a.out which will be the file you want to use in order to run the program.

But if you wanna make a file with the name you want then -

g++ -o desiredname progfile.cpp

now this will create a file with whatever name you give
and run it using


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.