I had installed GCC version 4.9 and 5.4 from the Ubuntu repositories. How to switch GCC version?
You can switch the symlinks yourself manually, but using "update-alternatives" makes it easy.
[ ]$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 100 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
[ ]$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50 --slave /usr/bin/g++ g++ /usr/bin/g++-5
Now you can switch between these versions by using:
[ ]$ sudo update-alternatives --config gcc
Change GCC 9 (Ubuntu 22.04)
[ ]$ sudo apt install gcc-9[ ]$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100
1 comment:
Use docker to switch build env?
Post a Comment