GCC-13/G++-13 安装#
最新版本的GCC/G++可添加ubuntu toolchain的test源获取
sudo add-apt-repository ppa:ubuntu-toolchain-r/test下载速度慢可切换到国内的ustc源
# 修改源文件/etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-focal.list
# deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu focal main
# 修改为
deb https://launchpad.proxy.ustclug.org/ubuntu-toolchain-r/test/ubuntu focal main当前最新的版本为13,其他版本只需要修改命令中的数字值即可。
sudo apt update
sudo apt install gcc-13 g++-13设置 GCC-13/G++-13 版本为默认编译器#
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100查看默认GCC/G++版本信息#
gcc --version
g++ --version