修改gcc/g++优先级 多版本gcc/g++ 共存

set priority to use [g++/gcc-4.9] before [g++/gcc-5] .

–>安装 gcc-4.9 and g+±4.9
~$ sudo apt-get install gcc-4.9 g+±4.9

–> 设置优先级: “priority=100” for gcc-4.9 and “priority=50” for gcc-5.
~$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 100
~$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5.0 50

–> 设置优先级 “priority=100” for g+±4.9 and “priority=50” for g+±5.
~$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g+±4.9 100
~$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g+±5.0 50

–> Verify the priority settings using:
~$ update-alternatives --query gcc

猜你喜欢

转载自blog.csdn.net/Hi_maxin/article/details/88055277