简体   繁体   English

我无法安装 g++

[英]I can't install g++

I want to install g++ on linux mint 19 with "sudo apt install g++".我想使用“sudo apt install g++”在 linux mint 19 上安装 g++。 Or by downloading by software manager but there is "Not Available".或者通过软件管理器下载但有“不可用”。 When I use command there is this message.当我使用命令时,会出现此消息。 Can you tell me how can I get it.你能告诉我怎样才能得到它。 Or how to compile cpp files with other compilators.或者如何用其他编译器编译cpp文件。 I have to compile .asm and .cpp files.我必须编译 .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 install aptitude -y && sudo aptitude install g++

This problem is there because ubutu has a default version of gcc that it wants to install when you type the command sudo apt install gcc which inturns depends on an older version of ubuntu so check mate.出现这个问题是因为 ubutu 有一个默认版本的 gcc,当您键入命令 sudo apt install gcc 时,它要安装它,这反过来取决于旧版本的 ubuntu,因此请检查 mate。

To get rid of the problem - install a newer version of gcc, g++ and point to it as your default gcc as follows:为了解决这个问题 - 安装一个更新版本的 gcc, g++ 并将它作为你的默认 gcc 指向它,如下所示:

sudo apt install gcc-10 g++-10 sudo apt 安装 gcc-10 g++-10

after installation :安装后:

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 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM