提示
GCC 4.8.1,这是该编译器由 C 语言实现转向 C++ 实现(4.8 版本)后的首次升级,也是第一个实现 C++ 11 所有语言特性的编译器。
Debian 8 Jessie
1 2 3 4 5 6
| # cp /etc/apt/sources.list /etc/apt/sources.list.bak
# echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list # echo "deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list
|
1 2 3 4 5 6
| # apt-get install -y gcc-4.8 g++-4.8 gdb
# ln -s /usr/bin/gcc-4.8 /usr/bin/gcc # ln -s /usr/bin/g++-4.8 /usr/bin/g++
|
Debian 9 Stretch
提示
build-essential
指的是编译程序必需的软件包,包含了 GCC、G++、Make 等工具- 在 Debian 9 Stretch 上安装
build-essential
后,得到的 GCC、G++ 的版本是 6.3.0
- 若希望在 Debian 9 Stretch 上安装低版本的 GCC/G++(例如 4.8),那么可以将上面 Debian 8 Jessie 的仓库源地址添加到 Debian 9 Stretch 系统里,然后使用同样的方法分别单独安装 GCC/G++
1 2 3 4 5 6 7 8 9 10 11 12
| # cp /etc/apt/sources.list /etc/apt/sources.list.bak
# echo "deb http://mirrors.163.com/debian/ stretch main non-free contrib" > /etc/apt/sources.list # echo "deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list # echo "deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list # echo "deb-src http://mirrors.163.com/debian/ stretch main non-free contrib" >> /etc/apt/sources.list # echo "deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list # echo "deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list # echo "deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib" >> /etc/apt/sources.list # echo "deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib" >> /etc/apt/sources.list
|
1
| # apt-get install -y build-essential gdb
|
Debian 11 Bullseye
提示
build-essential
指的是编译程序必需的软件包,包含了 GCC、G++、Make 等工具- 在 Debian 11 Bullseye 上安装
build-essential
后,得到的 GCC、G++ 的版本是 10.2.1
1 2 3 4 5 6 7 8 9 10 11 12
| # cp /etc/apt/sources.list /etc/apt/sources.list.bak
# echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free" > /etc/apt/sources.list # echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free" >> /etc/apt/sources.list # echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free" >> /etc/apt/sources.list # echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free" >> /etc/apt/sources.list # echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free" >> /etc/apt/sources.list # echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free" >> /etc/apt/sources.list # echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free" >> /etc/apt/sources.list # echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free" >> /etc/apt/sources.list
|
1
| # apt-get install -y build-essential gdb
|
参考博客