如何安装g ++编译器?

我尝试过以下方法:

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. 

但是当我编译终端时显示如下:

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

我该怎么办?

答案在你的问题中:

Try: sudo apt-get install

在你的情况下:

 sudo apt-get install g++