首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >linux手机管理多版本gcc和g++

linux手机管理多版本gcc和g++

作者头像
zhangrelay
发布于 2022-08-10 15:21:22
发布于 2022-08-10 15:21:22
3.4K0
举报
  1. cmake升级参考:

linux手机更新cmake版本

  1. gcc和g++升级参考:

linux手机更新 gcc g++ 版本


root@ubuntu-phablet:/# gcc --version

gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609

Copyright (C) 2015 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@ubuntu-phablet:/# gcc-9 --version

gcc-9 (Ubuntu 9.4.0-1ubuntu1~16.04) 9.4.0

Copyright (C) 2019 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


对于c++20已经支持了(g++-9)

root@ubuntu-phablet:/# g++ -std=c++2a

g++: error: unrecognized command line option ‘-std=c++2a’

g++: fatal error: no input files

compilation terminated.

root@ubuntu-phablet:/# g++-9 -std=c++2a

g++-9: fatal error: no input files

compilation terminated.


查看所有g++或gcc版本:

root@ubuntu-phablet:/# ls /usr/bin/g++*

/usr/bin/g++  /usr/bin/g++-5  /usr/bin/g++-9


将默认g++和gcc进行调整:

root@ubuntu-phablet:/# update-alternatives --display gcc

update-alternatives: error: no alternatives for gcc

root@ubuntu-phablet:/# update-alternatives --display g++

update-alternatives: error: no alternatives for g++

root@ubuntu-phablet:/# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10

update-alternatives: using /usr/bin/gcc-5 to provide /usr/bin/gcc (gcc) in auto mode

root@ubuntu-phablet:/# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 40

update-alternatives: using /usr/bin/gcc-9 to provide /usr/bin/gcc (gcc) in auto mode

root@ubuntu-phablet:/# update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10

update-alternatives: using /usr/bin/g++-5 to provide /usr/bin/g++ (g++) in auto mode

root@ubuntu-phablet:/# update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 40

update-alternatives: using /usr/bin/g++-9 to provide /usr/bin/g++ (g++) in auto mode

root@ubuntu-phablet:/# update-alternatives --display gcc

gcc - auto mode

  link best version is /usr/bin/gcc-9

  link currently points to /usr/bin/gcc-9

  link gcc is /usr/bin/gcc

/usr/bin/gcc-5 - priority 10

/usr/bin/gcc-9 - priority 40

root@ubuntu-phablet:/# update-alternatives --display g++

g++ - auto mode

  link best version is /usr/bin/g++-9

  link currently points to /usr/bin/g++-9

  link g++ is /usr/bin/g++

/usr/bin/g++-5 - priority 10

/usr/bin/g++-9 - priority 40


再次测试:


本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-07-13,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档