当前位置:   article > 正文

linux手机管理多版本gcc和g++_gcc-linaro-9.

gcc-linaro-9.

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


再次测试:


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/260848
推荐阅读
相关标签
  

闽ICP备14008679号