Switching
8. Switching System GCC
Finally, to easy Managing GCC Versions use update-alternatives
So first check where the GCC 10.2 location:which gcc
And if is into /usr/local/bin then provide to relocate it to use this location for the update-alternatives setup:
sudo mv /usr/local/bin/gcc /usr/bin/gcc-102
This because in the ordinary PATH Env setup /usr/local/bin takes precedence over /usr/bin.
Now install the New GCC 10.2 with:sudo update-alternatives --install /usr/local/bin/gcc gcc /usr/bin/gcc-102 10
And then the System GCC with for instance:
sudo update-alternatives --install /usr/local/bin/gcc gcc /usr/bin/gcc-9 20
Possibly amend the above Command with the Path found on Step 2.
Next to Switch between GCC Versions play:sudo update-alternatives --config gcc
Last, to test the GCC in use:
gcc -v

Congratulations, your GCC 10.2 should be now nicely working on Debian Buster. Good Luck! :)