Friday, May 3, 2024
13
rated 0 times [  13] [ 0]  / answers: 1 / hits: 17538  / 2 Years ago, sun, august 7, 2022, 5:06:01

I want to install GCC compiler 4.7 to use C++11 features. I have looked on the internet for instructions, and I found in several websites these steps:



sudo add-apt-repository ppa:Ubuntu-toolchain-r/test  
sudo apt-get update
sudo apt-get install gcc-4.7 g++-4.7


The problem is that my console freezes when adding the ppa.



At first I thought it was due to having an old Ubuntu version (11.04). So I have upgraded to 11.10 and then 12.04, and everything seems to work OK. But still having the same problem.



How to fix this issue?


More From » software-installation

 Answers
7

The error is that you mispelled the PPA. Try this:



sudo add-apt-repository ppa:ubuntu-toolchain-r/test  
sudo apt-get update
sudo apt-get install gcc-4.7 g++-4.7


If it doesn't work, create the source file manually:



sudo nano /etc/apt/sources.list.d/toolchain.list


Paste this content:



deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main   
deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main


Save the file with Ctrl-K and then press Y
key to confirm saving.



After adding those lines, issue this command to fix the key error:



sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F


Then run these commands in the terminal



sudo apt-get update
sudo apt-get install gcc-4.7 g++-4.7

[#35295] Monday, August 8, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pardsea

Total Points: 290
Total Questions: 115
Total Answers: 98

Location: Svalbard and Jan Mayen
Member since Sun, Sep 25, 2022
2 Years ago
;