我使用的是ubuntu 16.04并安装了g ++:
~$ sudo apt install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++ is already the newest version (4:5.3.1-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
但是,当我尝试使用它进行编译时,或者如果我只是调用它时,我收到一条错误消息,指出未安装g ++。
~$ g++
The program 'g++' is currently not installed. You can install it by typing:
sudo apt install g++
我已经尝试了apt update
和apt upgrade
,但没有任何变化。还安装了构建基本包:
~$ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
我怎样才能使用g ++?
答案 0 :(得分:2)
安装有问题,或者已经修改/损坏。
重新安装。
sudo apt-get install --reinstall g++