我无法安装g ++

时间:2019-05-10 21:03:30

标签: linux g++ install apt mint

我想在Linux Mint 19上使用“ sudo apt install g ++”安装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.

2 个答案:

答案 0 :(得分:0)

尝试一下:

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

答案 1 :(得分:0)

出现这个问题是因为 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