請參閱this thread和this answer:此錯誤可能是多個gcc版本替代方案的結果。
請參閱 「What exactly does update-alternatives
do?」
清除出來:
$ sudo update-alternatives --remove-all gcc
$ sudo update-alternatives --remove-all g++
然後重新安裝它們,並確保您的gcc和g ++引用相同的版本。
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
注(2017年三月):doug65536提到in the comments另一種情況:
I found a solution to the issue with my nvidia driver package.
I had installed a custom build of binutils
for a gdb
patch.
Forcing it to reinstall binutils
resolved the issue. It makes no sense, but it worked.
沒有它不工作 –
所有這些命令的輸出'更新替代:錯誤:沒有替代品gcc'或'update-alternatives:error:g ++'沒有選擇。 – doug65536
@ doug65536所以在你的情況下,你只需要安裝gcc/g ++ – VonC