參考:https://blog.csdn.net/qq_45316173/article/details/122018354
?
卸載舊版本
rpm -q gcc?
rpm -e [上一步查到的版本號]
?
執(zhí)行上面一條命令可能會報錯,卸載失敗:
error: Failed dependencies:
gcc = 4.4.7-23.el6 is needed by (installed) gcc-c++-4.4.7-23.el6.x86_64
gcc = 4.4.4 is needed by (installed) libtool-2.2.6-15.5.el6.x86_64
說明要卸載的程序已經(jīng)被其他程序依賴
將依賴gcc的程序卸載:
rpm -e gcc-c++-4.4.7-23.el6.x86_64
rpm -e libtool-2.2.6-15.5.el6.x86_64
然后,再次執(zhí)行卸載gcc的命令:
rpm -e [上一步查到的版本號]
?
yum -y install centos-release-scl
yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++?devtoolset-11-gdb
scl enable devtoolset-11 bash
which gcc
which cc
which g++
which gdb
?
cat >> /etc/profile << EOF
export PATH=$PATH:/opt/rh/devtoolset-11/root/usr/bin
EOF
?
source /etc/profile
?
yum -y install flex
yum -y install flex-devel
yum -y install bison
?
本文摘自 :https://www.cnblogs.com/