Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.