在centos下安装g++,如果输入 yum install g++,那么将会提示:
[root@hugo hugo]# yum install g++Loaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds from cached hostfile * base: centos.ustc.edu.cn * extras: centos.ustc.edu.cn * updates: centos.ustc.edu.cnSetting up Install ProcessNo package g++ available.Error: Nothing to do
因为在centos下g++安装包名字叫做:gcc-c++
所以应该输入 yum install gcc-c++,即可。
[root@hugo hugo]# yum -y install gcc-c++Loaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds from cached hostfile * base: centos.ustc.edu.cn * extras: centos.ustc.edu.cn * updates: centos.ustc.edu.cnSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package gcc-c++.x86_64 0:4.4.7-3.el6 will be installed--> Processing Dependency: libstdc++-devel = 4.4.7-3.el6 for package: gcc-c++-4.4.7-3.el6.x86_64--> Running transaction check---> Package libstdc++-devel.x86_64 0:4.4.7-3.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Installing: gcc-c++ x86_64 4.4.7-3.el6 base 4.7 MInstalling for dependencies: libstdc++-devel x86_64 4.4.7-3.el6 base 1.6 MTransaction Summary================================================================================Install 2 Package(s)Total download size: 6.3 MInstalled size: 20 MDownloading Packages:(1/2): gcc-c++-4.4.7-3.el6.x86_64.rpm | 4.7 MB 00:27 (2/2): libstdc++-devel-4.4.7-3.el6.x86_64.rpm | 1.6 MB 00:08 --------------------------------------------------------------------------------Total 178 kB/s | 6.3 MB 00:36