gcc version 5.3.0 20151204 (Ubuntu 5.3.0-3ubuntu1~14.04)
我的 g++ 有问题
当我搜索 g++ 时,我什么也没找到!
所以我尝试安装它;看起来 g++ 已经安装了,而且是最新的!
arubu@CQ56-LinuxMachine:~$ which g++
arubu@CQ56-LinuxMachine:~$ sudo apt-get install g++
[sudo] password for arubu:
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++ is already the newest version.
g++ set to manually installed.
The following packages were automatically installed and are no longer required:
libgranite-common libgranite1 libkeybinder-3.0-0
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
arubu@CQ56-LinuxMachine:~$ g++ -v
The program 'g++' is currently not installed. You can install it by typing:
sudo apt-get install g++
答案1
您应该强制重新安装该g++
软件包;这将恢复适当的符号链接:
sudo apt-get --reinstall install g++
完成此操作后,您应该会发现/usr/bin/g++
再次存在并且是 的符号链接g++-5
。
答案2
这/usr/bin/g++
是指向真正可执行文件的符号链接/usr/bin/x86_64-linux-gnu-g++
。我猜你的符号链接丢失了。尝试看看后一个文件是否存在,但前一个文件不存在。然后您可以通过发出手动修复它sudo ln -sv /usr/bin/X86_64-linux-gnu-g++ /usr/bin/g++
。
这个答案摘自这里。