Karol
Karol

Reputation: 11

I can't install g++

I want to install g++ on linux mint 19 with "sudo apt install 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. I have to compile .asm and .cpp files.

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.

Upvotes: 0

Views: 4418

Answers (2)

xwave
xwave

Reputation: 1

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.

To get rid of the problem - install a newer version of gcc, g++ and point to it as your default gcc as follows:

sudo apt install 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

Upvotes: 0

JosephWorks
JosephWorks

Reputation: 692

Try this:

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

Upvotes: 4

Related Questions