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?


1 Answer 1


The answer is in your question:

Try: sudo apt-get install <selected package>

In your case:

sudo apt-get install g++
  • 12
    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, 2014 at 1:29
  • 3
    @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, 2014 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .