c++ 时报错和原有 gcc 版本冲突

CentOS 6.7 安装 gcc-c++时报下面的错误:

Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.i686 0:4.4.7-11.el6 will be installed
--> Processing Dependency: libstdc++-devel = 4.4.7-11.el6 for package: gcc-c++-4.4.7-11.el6.i686
--> Processing Dependency: gcc = 4.4.7-11.el6 for package: gcc-c++-4.4.7-11.el6.i686
--> Running transaction check
---> Package gcc-c++.i686 0:4.4.7-11.el6 will be installed
--> Processing Dependency: gcc = 4.4.7-11.el6 for package: gcc-c++-4.4.7-11.el6.i686
---> Package libstdc++-devel.i686 0:4.4.7-11.el6 will be installed
--> Finished Dependency Resolution
Error: Package: gcc-c++-4.4.7-11.el6.i686 (c6-media)
          Requires: gcc = 4.4.7-11.el6
          Installed: gcc-4.4.7-16.el6.i686 (@base)
              gcc = 4.4.4-15.el6
              gcc = 4.4.7-16.el6
          Available: gcc-4.4.7-11.el6.i686 (c6-media)
              gcc = 4.4.7-11.el6
              gcc = 4.4.4-15.el6
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

解决办法:将 gcc,cpp, libgomp 等等依赖先删除掉,然后重新直接安装 gcc-c++,让其自动安装它的正确版本的依赖的 gcc, cpp, libgomp:

[root@localhost ~]# yum install gcc-c++
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * c6-media:
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.i686 0:4.4.7-11.el6 will be installed
--> Processing Dependency: libstdc++-devel = 4.4.7-11.el6 for package: gcc-c++-4.4.7-11.el6.i686
--> Processing Dependency: gcc = 4.4.7-11.el6 for package: gcc-c++-4.4.7-11.el6.i686
--> Running transaction check
---> Package gcc.i686 0:4.4.7-11.el6 will be installed
--> Processing Dependency: libgomp = 4.4.7-11.el6 for package: gcc-4.4.7-11.el6.i686
--> Processing Dependency: cpp = 4.4.7-11.el6 for package: gcc-4.4.7-11.el6.i686
--> Processing Dependency: libgomp.so.1 for package: gcc-4.4.7-11.el6.i686
---> Package libstdc++-devel.i686 0:4.4.7-11.el6 will be installed
--> Running transaction check
---> Package cpp.i686 0:4.4.7-11.el6 will be installed
---> Package libgomp.i686 0:4.4.7-11.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================
 Package                              Arch                      Version                            Repository                      Size
==========================================================================================================================================
Installing:
 gcc-c++                              i686                      4.4.7-11.el6                      c6-media                      4.3 M
Installing for dependencies:
 cpp                                  i686                      4.4.7-11.el6                      c6-media                      3.4 M
 gcc                                  i686                      4.4.7-11.el6                      c6-media                      8.2 M
 libgomp                              i686                      4.4.7-11.el6                      c6-media                      135 k
 libstdc++-devel                      i686                      4.4.7-11.el6                      c6-media                      1.6 M

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/15810.html