@yangwenbo
2024-06-27T16:08:28.000000Z
字数 1371
阅读 116
ubuntu系统
(base) root@FIB:~# vim /etc/apt/sources.list
(base) root@FIB:~# tail -1 /etc/apt/sources.list
deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe
(base) root@FIB:~# apt-get update
(base) root@FIB:~# apt-get -y install gcc-7 g++-7
#配置gcc版本的优先级
(base) root@FIB:~# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 50
(base) root@FIB:~# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 30
(base) root@FIB:~# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 20
#配置g++版本的优先级
(base) root@FIB:~# update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 50
(base) root@FIB:~# update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 30
(base) root@FIB:~# update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 20
(base) root@FIB:~/cu110# update-alternatives --config gcc
有 3 个候选项可用于替换 gcc (提供 /usr/bin/gcc)。
选择 路径 优先级 状态
------------------------------------------------------------
* 0 /usr/bin/gcc-7 50 自动模式
1 /usr/bin/gcc-10 30 手动模式
2 /usr/bin/gcc-11 20 手动模式
3 /usr/bin/gcc-7 50 手动模式
要维持当前值[*]请按<回车键>,或者键入选择的编号:
(base) root@FIB:~/cu110# update-alternatives --query gcc
Name: gcc
Link: /usr/bin/gcc
Status: manual
Best: /usr/bin/gcc-7
Value: /usr/bin/gcc-7
Alternative: /usr/bin/gcc-10
Priority: 30
Alternative: /usr/bin/gcc-11
Priority: 20
Alternative: /usr/bin/gcc-7
Priority: 50