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.

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 –  Jayesh Kumar Jul 26 at 16:16

1 Answer 1

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 W. Jun 18 at 1:29
@ThomasW. Did you read the question? –  enedil Jul 29 at 13:28
@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 W. Jul 29 at 13:48

protected by Community Aug 19 at 19:39

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

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.