I have 4.5.2 installed from the Ubuntu official repositories. I would like to install 4.6 as well to try out the C++0x features it brings.
How can I do this without breaking my system? I'm fine with the newer being default, but also want to keep the older version.
If you know your way around the command line, you should be able to compile from source and set the configuration to install in
/opt
.Something along the lines of
./configure --prefix=/opt
.I don't think that there is any way to do this via dpkg or the apt package management system. Thus, your option of resort is to compile from source, making this less of an Ubuntu question, and more of a gcc question. I am sure that
A good lead is to research setting up a "cross compiler", which in your case would use the same hardware architecture as your normal gcc.