【问题标题】:I can't install g++我无法安装 g++
【发布时间】:2019-09-28 18:55:59
【问题描述】:

我想使用“sudo apt install g++”在 linux mint 19 上安装 g++。或者通过软件管理器下载但有“不可用”。当我使用命令时,会出现此消息。你能告诉我我怎样才能得到它。或者如何使用其他编译器编译 cpp 文件。我必须编译 .asm 和 .cpp 文件。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 g++ : Depends: g++-7 (>= 7.3.0-12~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

【问题讨论】:

  • sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade.

标签: linux g++ installation apt linux-mint


【解决方案1】:

试试这个:

sudo apt install aptitude -y && sudo aptitude install g++

【讨论】:

    【解决方案2】:

    出现这个问题是因为 ubutu 有一个默认版本的 gcc,当您键入命令 sudo apt install gcc 时它要安装它,这又依赖于旧版本的 ubuntu,所以请检查伙伴。

    要解决这个问题 - 安装较新版本的 gcc、g++ 并将其指向您的默认 gcc,如下所示:

    sudo apt install gcc-10 g++-10

    安装后:

    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/ bin/gcov gcov /usr/bin/gcov-10

    【讨论】:

      猜你喜欢
      • 2021-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-26
      • 2017-10-25
      • 1970-01-01
      相关资源
      最近更新 更多