0

I am trying to install gcc-8 g++-8 on my Ubunutu 20.04 but I cannot as shown below. Any advice?

sudo apt install gcc-8 g++-8
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'clang-8-doc' for regex 'g++-8'
Note, selecting 'python-clang-8' for regex 'g++-8'
Note, selecting 'clang-8' for regex 'g++-8'
Note, selecting 'clang-8-examples' for regex 'g++-8'
Note, selecting 'libclang-8-dev' for regex 'g++-8'
E: Unable to locate package gcc-8
karel
  • 110,292
  • 102
  • 269
  • 299
Tak
  • 966
  • 3
  • 13
  • 32
  • 1
    Does this answer your question? [How do I enable the "Universe" repository?](https://askubuntu.com/questions/148638/how-do-i-enable-the-universe-repository) – karel Feb 18 '23 at 11:52

1 Answers1

0

There are 2 ways to accomplish this:

  • Install GCC and G++ using by doing:
sudo add-apt-repository universe 
sudo apt update 
sudo apt install gcc g++
  • You can do it with dpkg if it doesn't work:
wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-8/gcc-8_8.4.0-3ubuntu2_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-8/g++-8_8.4.0-3ubuntu2_amd64.deb
sudo dpkg -i g++-8_8.4.0-3ubuntu2_amd64.deb gcc-8_8.4.0-3ubuntu2_amd64.deb
sudo apt --fix-missing install
Rishon_JR
  • 1,019
  • 5
  • 25