I have the gcc installed. I can compile C programs. But I cannot compile C++ programs. If I write g++ on comd line, it says program not installed. I tried sudo apt-get install g++ It gives me a very long output, saying things like some packages cannot be installed and some are newest version already. Also tried

sudo apt-get install build-essential

It says build-essential package is not available. Also tried

sudo apt-get update

Nothing works. What to do now? How to compile g++ programs

  • g++ is the right package. dpkg --search g++ | grep bin g++: /usr/bin/x86_64-linux-gnu-g++ g++-4.9: /usr/bin/x86_64-linux-gnu-g++-4.9 g++: /usr/bin/g++ g++-4.9: /usr/bin/g++-4.9 You should resolve issues of your installation of g++. What is the error ?
    – Quentin
    Dec 22, 2014 at 15:49
  • What is your Ubuntu version? Dec 22, 2014 at 15:54

1 Answer 1


You have to enable main and universe repositories.

See how to do that in this question:

Problem installing build-essential on 14.04.1 LTS

You must log in to answer this question.

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