栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

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

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

1. cmake升级参考:

linux手机更新cmake版本

2. 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


再次测试:


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1011097.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号