Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

If I try compiling my C++ source file by the following command:

g++ a.cpp

it outputs:

The program 'g++' can be found in the following packages:
 * g++
 * pentium builder

sudo apt-get intsall <<a>selected package>

However, if I run the suggested command (sudo apt-get install g++), it shows that everything is already installed.

So, basically, how do I compile a simple C++ program in Ubuntu 12.04?

share|improve this question
What is the output of which g++? This sounds like g++ is not in your path. –  Chris Betti Dec 6 '12 at 14:16
Did you install build-essential? sudo apt-get install build-essential. –  Chris Betti Dec 6 '12 at 14:26

1 Answer 1

Try this

sudo apt-get update

sudo apt-get install build-essential

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.