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

I have tried the following:

sudo apt-get install build-essential 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

But when I compile the terminal shows the following:

g++ hello.cpp -o hello
The program 'g++' can be found in the following packages:
 * g++
 * pentium-builder
Try: sudo apt-get install <selected package>

What should I do?

share|improve this question
I am still getting the same result – user309431 Jul 26 '14 at 16:16

The answer is in your question:

Try: sudo apt-get install <selected package>

In your case:

sudo apt-get install g++
share|improve this answer
The other alternative is to install build-essential, which also includes build libraries commonly used, rather than just g++, but if all they need is the g++ compiler, then your command is accurate. – Thomas Ward Jun 18 '14 at 1:29
@enedil yes I did, however just installing g++ may omit dependent libraries you'll need for compilation of programs. Have you actually read my comment stating that the commands in the answer are correct if they don't want the other build libraries? – Thomas Ward Jul 29 '14 at 13:48

protected by Community Aug 19 '14 at 19:39

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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