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?
2 Answers
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.listPaste this content:
deb precise main
deb-src 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 1E9377A2BA9EF27FThen run these commands in the terminal
sudo apt-get update
sudo apt-get install gcc-4.7 g++-4.7 6 As an alternate answer, you could possibly use the built-in graphic repository manager. Do this by:
Firstly,
Open the Ubuntu Software Center:
Do this by clicking on the link on your Launcher.
Or, if you have removed it from the launcher, you can search for it via the dash.
Secondly,
Open the Software Sources menu:
Do this by locating the Edit menu and selecting 'Software Sources...' then once the window has opened, move to the 'Other Sources' tab.Lastly,
Add the PPA via the window:
Below your list of current PPAs, click the 'Add' button.
And when the window appears, enter the PPA address, which in your case is deb precise main and deb-src precise main
And click 'Add Source'.
You may also need to provide authentication by entering your user password.
And that's it.
Even if this doesn't work, the Software Centre may come up with a window with an error message, and most likely how to fix it. You won't believe what I went through to find a solution through the command-line and failed, and how relieved I was when I used the GUI and Ubuntu just spat the words out without me having to do anything. You may also want to combine these steps with the answer above, regarding the spelling error and such.
Cheers and good luck!
M
1