Posting this here because now it matters. By default OpenSuSE appears to install gcc-7 and cpp-7.
After you install version 11 of both via the package manager you still have a bit of work to do.
roland@localhost:~> su -
Password:
localhost:~ # update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 50
update-alternatives: using /usr/bin/gcc-11 to provide /usr/bin/gcc (gcc) in auto mode
localhost:~ # update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 20
localhost:~ # update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-11 50
update-alternatives: using /usr/bin/cpp-11 to provide /usr/bin/cpp (cpp) in auto mode
localhost:~ # update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-7 20
localhost:~ #
localhost:~ # update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-11 50 auto mode
1 /usr/bin/gcc-11 50 manual mode
2 /usr/bin/gcc-7 20 manual mode
Press <enter> to keep the current choice[*], or type selection number:
localhost:~ # update-alternatives --config cpp
There are 2 choices for the alternative cpp (providing /usr/bin/cpp).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/cpp-11 50 auto mode
1 /usr/bin/cpp-11 50 manual mode
2 /usr/bin/cpp-7 20 manual mode
Press <enter> to keep the current choice[*], or type selection number:
localhost:~ #
Should work on other Linux distros too. I don't know why they are still hanging back at 7 unless there is some kernel/core stuff that won't compile with newer compilers due to deprecation or later compilers forcing integer data types to be 2's complement. Real PITA for anyone working on a Unisys mainframe or doing low level device interfaces.