在centos下安装g++,如果输入 yum install g++,那么将会提示:
- [root@hugo hugo]# yum install g++
- Loaded plugins: fastestmirror, refresh-packagekit, security
- Loading mirror speeds from cached hostfile
- * base: centos.ustc.edu.cn
- * extras: centos.ustc.edu.cn
- * updates: centos.ustc.edu.cn
- Setting up Install Process
- No 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, security
- Loading mirror speeds from cached hostfile
- * base: centos.ustc.edu.cn
- * extras: centos.ustc.edu.cn
- * updates: centos.ustc.edu.cn
- Setting up Install Process
- Resolving 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 Resolution
- Dependencies Resolved
- ================================================================================
- Package Arch Version Repository Size
- ================================================================================
- Installing:
- gcc-c++ x86_64 4.4.7-3.el6 base 4.7 M
- Installing for dependencies:
- libstdc++-devel x86_64 4.4.7-3.el6 base 1.6 M
- Transaction Summary
- ================================================================================
- Install 2 Package(s)
- Total download size: 6.3 M
- Installed size: 20 M
- Downloading 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
via.http://blog.csdn.net/wh921021/article/details/8765044