升级 GCC 支持C++11 或 configure: error: *** A compiler with support for C++11 language features is requir
2019-05-19 09:33:34
转载自链接https://www.cnblogs.com/gyfluck/p/10537383.html)
一、错误发生情景:
安装vlc3.0软件时,报以下错误:
**configure: error: A compiler with support for C++11 language features is required. **
二、错误原因:
gcc版本太低了
三、解决问题:
(1)查看当前的gcc版本:
gcc -v
(2)下载高版本的gcc:
wget ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/releases/gcc-8.3.0/gcc-8.3.0.tar.gz
(3)解压:
tar -zxvf gcc-8.3.0.tar.gz
(4)进入目录
cd gcc-8.3.0
(5)配置
./configure --prefix=/usr/local/gcc-8.3.0 --enable-checking=release --enable-languages=c,c++ --disable-multilib
注意,如果出现错误以下错误:
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
请看文章底部的错误解决方法。
(6)编译
(7)安装
make install
(8)查看版本
gcc -v
如果发现版本没有变化,
可以删除旧版本的gcc,如果旧版的是用yum安装的,可以使用yum remove gcc。
然后把新安装的gcc的bin目录添加到环境变量中,/etc/pfofile文件中。
再查看版本,是否已变成最新安装的版本。
(9)更新标准库
(这一步,应该是需要的,gcc升级后,标准库还是旧的,可能影响一些编译操作。)
1、进入到刚才安装新的GCC的目录中:cd /usr/local/gcc-8.3.0
2、进入到库目录:cd lib64 (注意:系统如果是64位的就进入到lib64目录,否则进入到lib目录)
3、查看当前库的最搭版本:ls,结果看到:libstdc++.so.6.0.25
4、复制到系统默认的库目录下:
cp libstdc++.so.6.0.25 /usr/lib64/
5、进入到/usr/lib64下,查看相关的版本信息:
ls -l | grep libstdc++
libstdc++.so.6 -> libstdc++.so.6.0.13
libstdc++.so.6.0.13
libstdc++.so.6.0.25
6、删除旧的软连接:
rm -f libstdc++.so.6
7、建立新的软连接:
ln -s libstdc++.so.6.0.25 libstdc++.so.6
8、查看标准库最新的版本:
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
可以看到,已更新到最新的25版本。
可能遇见的错误:
在执行.configure命令时,可能遇到以下错误:
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
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the librari
es and the header
files. They may be located in separate packages.
错误说明,安装gcc需要这三个依赖:GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+。
错误中还指出了下载页面的地址:ftp://gcc.gnu.org/pub/gcc/infrastructure/。
1、打开链接:ftp://gcc.gnu.org/pub/gcc/infrastructure/。
2、找到需要的三个包地址,下载下来:
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz
3、安装GMP:
tar -jxvf gmp-6.1.0.tar.bz2
cd gmp-6.1.0
./configure
make && make install
4、安装MPFR:
tar -jxvf mpfr-3.1.4.tar.bz2
cd mpfr-3.1.4
./configure
make && make install
5、安装MPC:
tar -zxvf mpc-1.0.3.tar.gz
cd mpc-1.0.3
./configure
make && make install
<p class="MsoNormal"><strong><span style="text-indent: -18pt; font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">课程简介</span></span></strong></p>
<p class="MsoNormal"><span style="font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">C++ 11 14 17 20内存管理-指针、智能指针和内存池从基础到实战</span></span></p>
<p class="MsoNormal" style="margin-top: 5pt; margin-bottom: 5pt; margin-left: 18pt; text-indent: -18pt;"><!--[endif]--><strong><span style="font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">学习计划</span></span></strong></p>
<p class="MsoNormal" style="margin-top: 5pt; margin-bottom: 5pt; margin-left: 18pt; text-indent: -18pt;"><!-- [if !supportLists]--><span style="font-family: 宋体; font-size: 12pt;">1. </span><!--[endif]--><span style="font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">每天学习一小时以上</span></span></p>
<p class="MsoNormal" style="margin-top: 5pt; margin-bottom: 5pt; margin-left: 18pt; text-indent: -18pt;"><!-- [if !supportLists]--><span style="font-family: 宋体; font-size: 12pt;">2. </span><!--[endif]--><span style="font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">跟着视频动手编写代码</span></span></p>
<p class="MsoNormal" style="margin-top: 5pt; margin-bottom: 5pt; margin-left: 18pt; text-indent: -18pt;"><!-- [if !supportLists]--><span style="font-family: 宋体; font-size: 12pt;">3. </span><!--[endif]--><span style="font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">调试代码并对比课程多提供的源码</span></span></p>
<p class="MsoNormal" style="margin-top: 5pt; margin-bottom: 5pt; margin-left: 18pt; text-indent: -18pt;"><!-- [if !supportLists]--><strong><span style="font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">课程目标</span></span></strong></p>
<p class="MsoNormal" style="margin-top: 5pt; margin-bottom: 5pt; margin-left: 18pt; text-indent: -18pt;"><!-- [if !supportLists]--><span style="font-family: 宋体; font-size: 12pt;">1. </span><!--[endif]--><span style="font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">理解指针原理并学会智能指针和编程</span></span></p>
<p class="MsoNormal" style="margin-top: 5pt; margin-bottom: 5pt; margin-left: 18pt; text-indent: -18pt;"><!-- [if !supportLists]--><span style="font-family: 宋体; font-size: 12pt;">2. </span><!--[endif]--><span style="font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">理解</span><span style="font-family: 宋体;">c++17内存池技术</span></span></p>
<p class="MsoNormal" style="margin-top: 5pt; margin-bottom: 5pt; margin-left: 18pt; text-indent: -18pt;"><!-- [if !supportLists]--><span style="font-family: 宋体; font-size: 12pt;">3. </span><!--[endif]--><span style="font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">理解</span><span style="font-family: 宋体;">c++11 14 17 20 内存相关特性</span></span></p>
<p class="MsoNormal" style="margin-top: 5pt; margin-bottom: 5pt; margin-left: 18pt; text-indent: -18pt;"><!-- [if !supportLists]--><span style="font-family: 宋体; font-size: 12pt;">4. </span><!--[endif]--><span style="font-family: 宋体; font-size: 14pt;"><span style="font-family: 宋体;">拥有应用智能指针和内存池的实战的能力</span></span></p>
<p class="MsoNormal" style="margin-top: 5pt; margin-bottom: 5pt; margin-left: 18pt; text-indent: -18pt;"><img src="https://img-bss.csdnimg.cn/202106291428421411.jpg" alt="" /></p>
【GCC安装问题】configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
在编译安装的时候碰到“configure: error: ***A compiler with support for c++11 language features is required.”
是因为编译器版本不支持c++11,所以需要安装高版本gcc编译器以支持c++11,下面采用编译源码方式...
configure: error: *** A compiler with support for C++11 language features is required.
参考链接:
(1)升级 GCC 支持C++11。
(2)解决/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found的问题方法总结。
C++11升级包和安装方法
编译安装软件的时候,发现错误configure: error: *** A compiler with support for C++11 language features is required.
原来是gcc版本太低了,我的版本是gcc version 4.6.3
想要支持C++11,必须升级到gcc4.8以上。看看gcc的更新,决定升级到gcc4.9.4
Your c++ compiler does not fully support c++ 17等一系列cmake安装问题的解决关于Your c++ compiler does not fully support c++17原因
关于Your c++ compiler does not fully support c++17
首先第一次尝试:
参考该博主 maoni99999的文章,之前的Ubuntu系统也是出现过这个问题,按照该博主的方法解决了。但这次不太行,于是我就下载了新版的gcc9.2.0,参照该链接
此处我们使用163的yum源,配置如下
首先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份),以下为下载链接
https://mirrors.163.com/.help/CentOS6-Base-163.repo
运行以下命令生
如果没找到那可能就是缺了C++编译器
接下来就是安装相关包,用apt-cache命令查找相关包(因为我是debian)
apt-cache search c++ | grep "C++ compiler" | less
apt-cache search g++ | grep "C++ compiler" | less
以上命令可自由变通
找到之后安装即可
如果还是不可以
就是由于gcc版本低,需要删除原来的gc
------------------------------------------------------------------------------------------------------------------------------
在编译安装软件的时候,发现错误configure: error: *** A compiler with support for C++11 la...
ODB简介ODB是用于C ++的开源,跨平台和跨数据库对象关系映射(ORM)系统。 它允许您将C ++对象保留到关系数据库,而无需处理表,列或SQL,而无需手动编写任何映射代码。 ODB支持MySQL,SQLite,PostgreSQL,Oracle和Microsoft SQL Server关系数据库以及C ++ 98/03和C ++ 11语言标准。 它还带有Boost和Qt的可选配置文件,允许您...
GNU编译器套件(GNU Compiler Collection)包括C、C++、Objective-C、Fortran、Java、Ada和Go语言的前端,也包括了这些语言的库(如libstdc++、libgcj等等)。
gcc-4.9.4版本支持C++11.
C++11,(即ISO/IEC 14882:2011),是目前的C++编程语言的最新正式标准。它取代了第二版标准(第一版公开于1998年,第二版于2003年更新,分别通称C++98以及C++03,两者差异很小)。新的标准包含核心语言的新机能,而且扩展C++标准程序库。C++11新标准由C++标准委员会于2011年8月12日公布,并于2011年9月出版。此次标准为C++98发布后13年来第一次重大修