cenos 升级 g++ gcc(cc1plus: error: unrecognized command line option "-std=c++11")
来源:互联网 发布:数据挖掘兴起于哪一年 编辑:程序博客网 时间:2024/05/20 02:28
Building with 'g++'.
Error using mex
cc1plus: error: unrecognized command line option "-std=c++11"
1、下载源码
在这里,稳妥起见,选择了4.8.5,如果需要别的版本,改掉版本号就好了,可以去GCC官网查看
$ wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.gz
2、下载依赖包 & 预安装
编译安装 GCC 需要依赖 mpc,mpfr,gmp包。好在 GCC 源码里自带脚本可以轻松下载依赖包。
$ tar zxf gcc-4.8.5.tar.gz
$ cd gcc-4.8.5
$ ./contrib/download_prerequisites
4、编译安装
$ cd .. //这样做的原因主要是要在源代码外建立build文件夹
$ mkdir gcc-build-4.8.5
$ mkdir /usr/local/gcc-4.8.5 //放置的是 include 文件。
$ mkdir /usr/local/gcc //放置的是 bin + lib 文件
$ cd gcc-build-4.8.5
$ ../gcc-4.8.5/configure --prefix=/usr/local/gcc-4.8.5 --exec-prefix=/usr/local/gcc --enable-languages=c,c++ //为了节省时间,这里只编译c和c++的
$ make && make install
为了避免安装后系统里出现多个版本的 GCC,这里直接将编译安装的目录指定为 /usr/local/gcc-4.8.5和/usr/local/gcc下,如果不指定 –prefix,则会默认安装到/usr/local下。
等待
make以后,漫长的等待,搞定
5、环境变量配置
将 gcc/g++改名,留存旧版本
$ mv /usr/bin/gcc /usr/bin/gcc-4.4.7
$ mv /usr/bin/g++ /usr/bin/g++-4.4.7
$ export PATH=/usr/local/gcc/bin:$PATH # 使用最新的 gcc/g++;
确认版本号
$ g++ --version
$ gcc --version
$ which g++
$ which gcc
错误
1、Build文件夹建立到错误的位置 stubs-32.h 找不到,CentOS 是64位的
compilation terminated.
make[5]: *** [_muldi3.o] Error 1
make[5]: Leaving directory `/home/wei/gcc-4.8.5/gcc-build-4.8.5/x86_64-unknown-linux-gnu/32/libgcc'
…………
解决方法:安装 32 位的 glibc-devel,后面的参数是忽略某个软件的多版本问题。
$ yum -y install glibc-devel.i686 --setopt=protected_multilib=false
这个错主要原因是新建的build文件夹在源代码树里,需要在另外独立的文件夹使用。 解决方法是:在源代码外新建了文件夹,解决后的代码已经更新到上面了。
First, we highly recommend that GCC be built into a separate directory from the sources whichdoes not reside within the source tree. This is how we generally build GCC; building where srcdir == objdir should still work, but doesn’t get extensive testing; building where objdir is a subdirectory of srcdir is unsupported.
Error using mex
cc1plus: error: unrecognized command line option "-std=c++11"
1、下载源码
在这里,稳妥起见,选择了4.8.5,如果需要别的版本,改掉版本号就好了,可以去GCC官网查看
$ wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.gz
2、下载依赖包 & 预安装
编译安装 GCC 需要依赖 mpc,mpfr,gmp包。好在 GCC 源码里自带脚本可以轻松下载依赖包。
$ tar zxf gcc-4.8.5.tar.gz
$ cd gcc-4.8.5
$ ./contrib/download_prerequisites
在此脚本里可以看到依赖包的版本号依次是 mpc-0.8.1,mpfr-2.4.2,gmp-4.3.2。
3、$ yum -y install glibc-devel.i686 --setopt=protected_multilib=false
4、编译安装
$ cd .. //这样做的原因主要是要在源代码外建立build文件夹
$ mkdir gcc-build-4.8.5
$ mkdir /usr/local/gcc-4.8.5 //放置的是 include 文件。
$ mkdir /usr/local/gcc //放置的是 bin + lib 文件
$ cd gcc-build-4.8.5
$ ../gcc-4.8.5/configure --prefix=/usr/local/gcc-4.8.5 --exec-prefix=/usr/local/gcc --enable-languages=c,c++ //为了节省时间,这里只编译c和c++的
$ make && make install
为了避免安装后系统里出现多个版本的 GCC,这里直接将编译安装的目录指定为 /usr/local/gcc-4.8.5和/usr/local/gcc下,如果不指定 –prefix,则会默认安装到/usr/local下。
等待
make以后,漫长的等待,搞定
5、环境变量配置
将 gcc/g++改名,留存旧版本
$ mv /usr/bin/gcc /usr/bin/gcc-4.4.7
$ mv /usr/bin/g++ /usr/bin/g++-4.4.7
$ export PATH=/usr/local/gcc/bin:$PATH # 使用最新的 gcc/g++;
确认版本号
$ g++ --version
$ gcc --version
$ which g++
$ which gcc
错误
1、Build文件夹建立到错误的位置 stubs-32.h 找不到,CentOS 是64位的
compilation terminated.
make[5]: *** [_muldi3.o] Error 1
make[5]: Leaving directory `/home/wei/gcc-4.8.5/gcc-build-4.8.5/x86_64-unknown-linux-gnu/32/libgcc'
…………
解决方法:安装 32 位的 glibc-devel,后面的参数是忽略某个软件的多版本问题。
$ yum -y install glibc-devel.i686 --setopt=protected_multilib=false
这个错主要原因是新建的build文件夹在源代码树里,需要在另外独立的文件夹使用。 解决方法是:在源代码外新建了文件夹,解决后的代码已经更新到上面了。
First, we highly recommend that GCC be built into a separate directory from the sources whichdoes not reside within the source tree. This is how we generally build GCC; building where srcdir == objdir should still work, but doesn’t get extensive testing; building where objdir is a subdirectory of srcdir is unsupported.
0 0
- cenos 升级 g++ gcc(cc1plus: error: unrecognized command line option "-std=c++11")
- cc1plus: error: unrecognized command line option ‘-std=c++11’
- 问题:cc1plus.exe: error: unrecognized command line option '-std=gnu++11' compilation terminated due to
- c++: error: unrecognized command line option ‘-std=c++14’
- g++ thread error:unrecognized command line option '-std=C++11'
- mex error: unrecognized command line option ‘-std=c++11’
- unrecognized command line option “ std=c 11”
- unrecognized command line option “-std=null” 及升级gcc的方式
- 错误:unrecognized command line option “-std=c++11”
- 错误:unrecognized command line option “-std=c++11”
- 错误:unrecognized command line option “-std=c++11”
- 错误:unrecognized command line option “-std=c++11”
- unrecognized command line option ‘-std=c++11’
- 错误:unrecognized command line option “-std=c++11”
- 错误:unrecognized command line option “-std=c++11”,解决ubuntu不支持c++11的问题
- Linux下C++编译提示错误:unrecognized command line option “-std=c++11”
- 安装gcc4.9.3后编译时出现unrecognized command line option “-std=c++11”
- openssl error: unrecognized command line option "-m486"
- 反转链表
- 头文件顺序
- EasyMovieTexture在Vuforia中运用
- C++ 著名类库整理
- java中单片redis到底应该怎么用,实践出真理
- cenos 升级 g++ gcc(cc1plus: error: unrecognized command line option "-std=c++11")
- 分布式,使用spring-session管理session
- pandas 数据分组和聚合
- 【Python专题】python入门之代码编辑器和输入输出
- opencv笔记(5):Hough变换
- 161. One Edit Distance
- set 和list区别
- 深入理解Java之线程池
- ABAP/4 版本管理使用小记