Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Some time ago, I managed to find PPA featuring g++-4.7 build. However, I had to reinstall everything on my machine and I lost name of that PPA. Could anyone point me to it? I tried to find it again, but without any luck. I'm on Ubuntu 11.10 installation.

share|improve this question
1  
I strongly recommend you do not install 4.7 in place of gcc that is with your version. If you do, you run the risk of breaking your system. –  Thomas W. Feb 17 '12 at 17:20
    
@ThomasWard: I know, I am not a complete newbie. –  Griwes Feb 19 '12 at 17:23
1  
@Griwes, you may not be a 'newbie' but others might be and his observation is correct. –  Gearoid Murphy Nov 5 '12 at 21:08
    
Related. (But if we decide that's a duplicate of this, we should make sure to ask for answers to be merged, as that's about what to do when this doesn't work.) –  Eliah Kagan Jan 14 '13 at 0:17

3 Answers 3

up vote 17 down vote accepted

The Toolchain test builds PPA contains many packages including gcc-4.7.

You can add the repository using

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

Then, to install it use

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

To change the default compiler use update-alternatives

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
sudo update-alternatives --config gcc
share|improve this answer
    
Did not work for me. I only see gcc-4.6 (on ubuntu 11.10) –  Ugo Apr 21 '12 at 9:00
    
Worked with ubuntu 12.04 –  Ugo May 1 '12 at 20:10
    
How can I uninstall g++-4.6 without uninstalling g++ ? Currently I have packages g++, g++-4.6 and g++-4.7 installed. as result g++ --version gives me version 4.6. –  ruslan Sep 24 '12 at 4:24
    
Ah perhaps I need simply rename g++-4.7 to g++ –  ruslan Sep 24 '12 at 4:29

I haven't found a PPA for g++-4.7 but there is a gcc-snapshot package.

I guess you have to compile it yourself: http://www.lukaszbyczynski.com/archives/208

share|improve this answer
    
Well, I cannot find it now, but I recall doing apt-get install g++-4.7 gcc-4.7... –  Griwes Nov 7 '11 at 20:23

See http://ask.debian.net/questions/backporting-more-recent-versions-of-the-gcc-toolchain-to-debian-stable

for my description of backporting gcc 4.7 to Debian stable.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.