安装gcc-c++报错解决办法

Posted lemon-le

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装gcc-c++报错解决办法相关的知识,希望对你有一定的参考价值。

问题

每次安装依赖包gcc-c++的时候,经常会遇到包如下错误
 
Error: Package: libstdc++-devel-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
           Requires: libstdc++(x86-64) = 4.8.5-16.el7_4.2
           Installed: libstdc++-4.8.5-28.el7_5.1.x86_64 (installed)
               libstdc++(x86-64) = 4.8.5-28.el7_5.1
           Available: libstdc++-4.8.5-16.el7.x86_64 (ultra-centos-7.4-base)
               libstdc++(x86-64) = 4.8.5-16.el7
           Available: libstdc++-4.8.5-16.el7_4.1.x86_64 (ultra-centos-7.4-updates)
               libstdc++(x86-64) = 4.8.5-16.el7_4.1
           Available: libstdc++-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
               libstdc++(x86-64) = 4.8.5-16.el7_4.2
Error: Package: glibc-headers-2.17-196.el7_4.2.x86_64 (ultra-centos-7.4-updates)
           Requires: glibc = 2.17-196.el7_4.2
           Installed: glibc-2.17-222.el7.x86_64 (installed)
               glibc = 2.17-222.el7
           Available: glibc-2.17-196.el7.x86_64 (ultra-centos-7.4-base)
               glibc = 2.17-196.el7
           Available: glibc-2.17-196.el7_4.2.x86_64 (ultra-centos-7.4-updates)
               glibc = 2.17-196.el7_4.2
Error: Package: gcc-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
           Requires: libgomp = 4.8.5-16.el7_4.2
           Installed: libgomp-4.8.5-28.el7_5.1.x86_64 (installed)
               libgomp = 4.8.2-16.el7_5
               libgomp = 4.8.5-28.el7_5.1
           Available: libgomp-4.8.5-16.el7.x86_64 (ultra-centos-7.4-base)
               libgomp = 4.8.5-16.el7
               libgomp = 4.8.2-16.el7
           Available: libgomp-4.8.5-16.el7_4.1.x86_64 (ultra-centos-7.4-updates)
               libgomp = 4.8.5-16.el7_4.1
               libgomp = 4.8.2-16.el7_4
           Available: libgomp-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
               libgomp = 4.8.5-16.el7_4.2
               libgomp = 4.8.2-16.el7_4
Error: Package: gcc-c++-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
           Requires: libstdc++ = 4.8.5-16.el7_4.2
           Installed: libstdc++-4.8.5-28.el7_5.1.x86_64 (installed)
               libstdc++ = 4.8.2-16.el7_5
               libstdc++ = 4.8.5-28.el7_5.1
           Available: libstdc++-4.8.5-16.el7.x86_64 (ultra-centos-7.4-base)
               libstdc++ = 4.8.5-16.el7
               libstdc++ = 4.8.2-16.el7
           Available: libstdc++-4.8.5-16.el7_4.1.x86_64 (ultra-centos-7.4-updates)
               libstdc++ = 4.8.5-16.el7_4.1
               libstdc++ = 4.8.2-16.el7_4
           Available: libstdc++-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
               libstdc++ = 4.8.5-16.el7_4.2
               libstdc++ = 4.8.2-16.el7_4
Error: Package: glibc-devel-2.17-196.el7_4.2.x86_64 (ultra-centos-7.4-updates)
           Requires: glibc = 2.17-196.el7_4.2
           Installed: glibc-2.17-222.el7.x86_64 (installed)
               glibc = 2.17-222.el7
           Available: glibc-2.17-196.el7.x86_64 (ultra-centos-7.4-base)
               glibc = 2.17-196.el7
           Available: glibc-2.17-196.el7_4.2.x86_64 (ultra-centos-7.4-updates)
               glibc = 2.17-196.el7_4.2
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

 

原因

yum源没有对应版本包匹配
 

解决方法

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sed -i  s/$releasever/7/g /etc/yum.repos.d/CentOS-Base.repo
yum repolist 

 

 
 

以上是关于安装gcc-c++报错解决办法的主要内容,如果未能解决你的问题,请参考以下文章

Vue报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object 的解决方法(代码片段

解决移动端报错:Unable to preventDefault inside passive event listener due to target being treated as……(代码片段

linux安装gcc报错,该怎么解 E: 未发现软件包 gcc-c+ E: 无法按照正则表达式 gcc-c+ 找到任何软件包

linux 下安装redis报错解决

解决go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘(代码片段

项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde(代码片段