linux 非管理员源码安装gcc/g++
tar -zvxf gcc-11.2.0.tar.gz cd gcc-11.2.0 ./contrib/download_prerequisites mkdir build cd build/ ../configure --prefix=/home/lihc/tools/gcc-11.2.0-build -enable-checking=release -enable-languages=c,c++ -disable-multilib make -j make install
--prefix后面的参数为你的安装目录,之后把安装路径添加到环境变量中
echo 'export PATH="/home/lihc/tools/gcc-11.2.0-build/bin:$PATH" ' >>~/.bashrc source ~/.bashrc
检查是否安装完成成功
gcc -v