How to use GCC 4.7 in place of 4.6 (Ubuntu 12.04)

Posted by Larz Conwell on Ask Ubuntu See other posts from Ask Ubuntu or by Larz Conwell
Published on 2012-08-30T02:37:54Z Indexed on 2012/08/30 3:49 UTC
Read the original article Hit count: 300

Filed under:
|

So I'm working on a project and I wanted to use some C11 features for C. To use those features GCC 4.7 is required, so I went to synaptic and looked up 4.7, and I found the packages gcc-4.7-base so I installed it[1].

So now that gcc-4.7-base is installed I expected to be able to use 4.7, but no, when I do gcc --version it still shows 4.6.3 even more, when I try to directly call 4.7(via /usr/bin/gcc-4.7) it doesn't exist, though a gcc-4.6 executable does exist.

How do I "activate" GCC 4.7? I read here, you do some crazy stuff with update-alternatives, but it doesn't work for me as the gcc-4.7 executable doesn't actually exist on my machine.

Notes: 1. I also saw gcc-4.6-base, so I figured I'd uninstall it, but synaptic attempted to remove every package I had installed and install a Java runtime, so for obvious reason I decided not to remove it.

© Ask Ubuntu or respective owner

Related posts about gcc

Related posts about update-alternatives