查看了几个有类似问题的问题,但没有任何解决方案。问题是:
$ sudo apt-get Install g++
The following packges have unmet dependencies:
g++ : Depends:g++-4.8 (>= 4.8.2-5~) but it is not going to be installed
E:Unable to correct problems, you have held broken packages.
从我尝试过的其他问题来看:
sudo apt-get update
sudo app-get -f Install*
sudo apt-cache policy g++-4.8
g++-4.8: Installed: (none) Candidate: 4.8.2-19ubuntu1 Version table: 4.8.2-19ubuntu1 0 500 http://ca.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
$ sudo apt-get install g++-4.8
The following packages have unmet dependencies:
g++-4.8 : Depends: gcc-4.8-base (= 4.8.2-19ubuntu1) but 4.8.4-2ubuntu1~14.04 is to be installed
Depends: gcc-4.8 (= 4.8.2-19ubuntu1) but 4.8.4-2ubuntu1~14.04 is to be installed
Depends: libstdc++-4.8-dev (= 4.8.2-19ubuntu1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ apt-cache policy gcc-4.8-base gcc-4.8 libstdc++-4.8-dev; sudo apt-get install gcc-4.8-base gcc-4.8 libstdc++-4.8-dev
gcc-4.8-base and gcc-4.8 Installed=Candidate
but
libstdc++-4.8-dev:
Installed: (none)
Candidate: 4.8.2-19ubuntu1
Version Table:
4.8.2-19ubuntu1 0
500 http//:archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
我对这一切完全陌生,从闪存驱动器运行 ubuntu,只需要安装 g++。任何帮助都将不胜感激。
根据尝试过的建议:
sudo-apt 安装 aptitude
很多错误都说'Could not resolve archive.ubuntu.com'
答案1
终于搞明白了。谢谢@sinclair
通过将我的无线网络更改为另一个网络来解决网络问题,然后运行,sudo apt-get install aptitude
最初sudo aptitude install build-essentials
失败了,但通过内置故障排除,它给了我降级的选项,这解决了所有问题。现在我有了我需要的 g++。