admin管理员组文章数量:1571388
当编译的时候,出现
cc1plus: error: bad value (‘tigerlake’) for ‘-march=’ switch
就是由于gcc版本过低导致的。
通过运行下面命令
gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.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.
可知,20.04的gcc为9.3.0
通过下面命令更新以及转换
sudo apt install gcc-10 g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
此时查看版本显示
gcc (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
Copyright (C) 2020 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.
也可以换回默认的
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
以后,如果要更改默认版本,请使用以下update-alternatives
命令:
系统将为您提供Ubuntu系统上所有已安装的GCC版本的列表。输入您要用作默认版本的版本号,然后按Enter
。
sudo update-alternatives --config gcc
该命令将创建指向GCC和G ++特定版本的符号链接。
注意:系统已有的g++ gcc不支持c++11,可能需要改为c++14
参考资料
如何在Ubuntu 20.04上安装GCC(build-essential)以及如何在Ubuntu 20.04系统安装多版本的GCC - GlaryJoker - 博客园
版权声明:本文标题:ROS学习笔记之——多个版本GCC 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1727689534a1125710.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论