sudo apt-get 安装 libstdc++

use*_*923 20 apt gcc

当我尝试libstdc++使用以下方法安装时:

sudo apt-get install libstdc++
Run Code Online (Sandbox Code Playgroud)

我在 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.
Run Code Online (Sandbox Code Playgroud)

ste*_*ver 16

实际上没有一个名为的包libstdc++(可能您正在尝试安装libstdc++6?)

当 apt 找不到与包名称完全匹配的内容时,它会将给定的字符串视为正则表达式。在这种情况下,这++会导致它尝试安装任何名称匹配且libstd后跟一个或多个的软件包c- 如您所见,其中许多是冲突的。

不幸的是,我从来没有设法弄清楚如何关闭这种行为(我过去尝试使用转义字符似乎没有任何效果) - 我知道的唯一解决方案是小心地给出一个确切的包名,其中任何正则表达式字符可能会被误解,并确保包目录是最新的,即

sudo apt-get update
sudo apt-get install libstdc++6
Run Code Online (Sandbox Code Playgroud)


M.A*_*pon 12

首先运行这些命令

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install aptitude
Run Code Online (Sandbox Code Playgroud)

然后尝试

sudo apt-get install libstdc++6
Run Code Online (Sandbox Code Playgroud)

或尝试此搜索结果并从列出的http://packages.ubuntu.com/search?keywords=libstdc%2B%2B安装一个所需的包

  • 哦,如果你不使用它来安装 `libstdc++6`,为什么要安装 `aptitude`? (7认同)
  • +1 很好的答案,但是 `build-essential` 中不包含 `libstdc++` 吗? (2认同)
  • 感谢您的回复凯夫。我试图在不成功的情况下给出某种可能性。以及处理他的错误的能力。 (2认同)