报错:unrecognized command line option ‘-std=c++11’

使用命令查看g++版本。

root@ubuntu:/home/neo# g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 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.

root@ubuntu:/home/neo# 

ubuntu系统中是4.6.3版本,不支持c++11。-std=c++11至少需要4.8的版本

下载“gcc-4.8.2.tar.gz”安装包:
https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/

下载完之后解压、运行脚本。

tar -vxf gcc-4.8.2.tar.bz2 
cd gcc-4.8.2/contrib/
./download_prerequisites
cd ..
mkdir __install
cd __install/
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make & make install 

在运行上述命令过程中会报如下错误:

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify

解决办法:

https://blog.csdn.net/weixin_38184741/article/details/85858761

参考链接:
https://jingyan.baidu.com/article/15622f2435355dfdfcbea595.html