当我尝试libstdc++
使用以下方法安装时:
sudo apt-get install libstdc++
我在 Ubuntu 中遇到了以下错误。你知道吗?
The following packages have unmet dependencies:
libstdc++-4.8-doc : Conflicts: libstdc++6-4.4-doc but 4.4.7-8ubuntu1 is to be installed
Conflicts: libstdc++6-4.6-doc but 4.6.4-6ubuntu2 is to be installed
Conflicts: libstdc++6-4.7-doc but 4.7.3-12ubuntu1 is to be installed
libstdc++-4.9-doc : Conflicts: libstdc++-4.8-doc but 4.8.5-2ubuntu1~14.04.1 is to be installed
Conflicts: libstdc++6-4.4-doc but 4.4.7-8ubuntu1 is to be installed
Conflicts: libstdc++6-4.6-doc but 4.6.4-6ubuntu2 is to be installed
Conflicts: libstdc++6-4.7-doc but 4.7.3-12ubuntu1 is to be installed
libstdc++-5-doc : Conflicts: libstdc++-4.8-doc but 4.8.5-2ubuntu1~14.04.1 is to be installed
Conflicts: libstdc++-4.9-doc but 4.9.3-8ubuntu2~14.04 is to be installed
Conflicts: libstdc++6-4.4-doc but 4.4.7-8ubuntu1 is to be installed
Conflicts: libstdc++6-4.6-doc but 4.6.4-6ubuntu2 is to be installed
Conflicts: libstdc++6-4.7-doc but 4.7.3-12ubuntu1 is to be installed
libstdc++6-4.6-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-8ubuntu1 is to be installed
libstdc++6-4.6-doc : Conflicts: libstdc++6-4.4-doc but 4.4.7-8ubuntu1 is to be installed
libstdc++6-4.7-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-8ubuntu1 is to be installed
Conflicts: libstdc++6-4.6-dbg but 4.6.4-6ubuntu2 is to be installed
libstdc++6-4.7-doc : Conflicts: libstdc++6-4.4-doc but 4.4.7-8ubuntu1 is to be installed
Conflicts: libstdc++6-4.6-doc but 4.6.4-6ubuntu2 is to be installed
libstdc++6-4.8-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-8ubuntu1 is to be installed
Conflicts: libstdc++6-4.6-dbg but 4.6.4-6ubuntu2 is to be installed
Conflicts: libstdc++6-4.7-dbg but 4.7.3-12ubuntu1 is to be installed
libstdc++6-4.8-dbg-armhf-cross : Conflicts: libstdc++6-4.7-dbg-armhf-cross but 4.7.3-11ubuntu1cross1.85 is to be installed
libstdc++6-4.9-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-8ubuntu1 is to be installed
Conflicts: libstdc++6-4.6-dbg but 4.6.4-6ubuntu2 is to be installed
Conflicts: libstdc++6-4.7-dbg but 4.7.3-12ubuntu1 is to be installed
Conflicts: libstdc++6-4.8-dbg but 4.8.5-2ubuntu1~14.04.1 is to be installed
libstdc++6-5-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-8ubuntu1 is to be installed
Conflicts: libstdc++6-4.6-dbg but 4.6.4-6ubuntu2 is to be installed
Conflicts: libstdc++6-4.7-dbg but 4.7.3-12ubuntu1 is to be installed
Conflicts: libstdc++6-4.8-dbg but 4.8.5-2ubuntu1~14.04.1 is to be installed
Conflicts: libstdc++6-4.9-dbg but 4.9.3-8ubuntu2~14.04 is to be installed
E: Unable to correct problems, you have held broken packages.
答案1
实际上没有一个名为的包libstdc++
(可能是您正在尝试安装libstdc++6
?)
当 apt 找不到与软件包名称完全匹配的软件包时,它会将给定的字符串视为正则表达式。在这种情况下,它++
会尝试安装任何名称匹配的包libstd
后面跟着一个或多个c
- 其中许多是冲突的,正如您所见。
不幸的是,我从来没有设法弄清楚如何关闭这种行为(我过去使用转义字符尝试过的方法似乎都没有奏效) - 我知道的唯一解决方案是小心给出一个准确的包名称,任何正则表达式字符都可能被误解,并确保包目录是最新的,即
sudo apt-get update
sudo apt-get install libstdc++6
答案2
首先运行这些命令
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install aptitude
然后尝试
sudo apt-get install libstdc++6
或者尝试此搜索结果并从列出的结果中安装一个所需的包http://packages.ubuntu.com/search?keywords=libstdc%2B%2B
答案3
LD_LIBRARY_PATH=/usr/local/lib64/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9