GCC

From My Notepad
Jump to: navigation, search

Switching between GCC versions in Ubuntu

# Make sure the version of GCC and G++ are installed before running these
apt-get install gcc-4.8 g++-4.8
apt-get install gcc-4.9 g++-4.9

# Switch to Version 4.8
rm /usr/bin/gcc && ln -s /usr/bin/gcc-4.8 /usr/bin/gcc && rm /usr/bin/g++ && ln -s /usr/bin/g++-4.8 /usr/bin/g++ && ls -l /usr/bin/gcc /usr/bin/g++

# Switch to Version 4.9
rm /usr/bin/gcc && ln -s /usr/bin/gcc-4.9 /usr/bin/gcc && rm /usr/bin/g++ && ln -s /usr/bin/g++-4.9 /usr/bin/g++ && ls -l /usr/bin/gcc /usr/bin/g++

# Switch to Version 5
rm /usr/bin/gcc && ln -s /usr/bin/gcc-5 /usr/bin/gcc && rm /usr/bin/g++ && ln -s /usr/bin/g++-5 /usr/bin/g++ && ls -l /usr/bin/gcc /usr/bin/g++