当前位置:首页 > 操作系统 > Linux

Linux make: g++: Command not found

Linux使用make命令时遇到“make: g++: Command not found”,这个主要是没有安装gcc-c++.x86_64,如下所示

                 
            
                [root@localhost nethogs]# make
            
                g++ -g -Wall -Wextra -c packet.cpp
            
                make: g++: Command not found
            
                make: *** [packet.o] Error 127
            

 

                root@localhost nethogs]# yum search "gcc-c++"
            
                Loaded plugins: product-id, security, subscription-manager
            
                This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
            
                ==================================== N/S Matched: gcc-c++ ====================================
            
                gcc-c++.x86_64 : C++ support for GCC
            
                 
            
                  Name and summary matches only, use "search all" for everything.
            
                [root@localhost nethogs]# yum list "gcc-c++"
            
                Loaded plugins: product-id, security, subscription-manager
            
                This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
            
                media                                                                  | 4.1 kB     00:00 ... 
            
                Available Packages
            
                gcc-c++.x86_64                               4.4.7-11.el6                                media
            

 

[root@localhost nethogs]# yum install "gcc-c++.x86_64"
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.x86_64 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.x86_64
--> Processing Dependency: libstdc++-devel = 4.4.7-11.el6 for package: gcc-c++-4.4.7-11.el6.x86_64
--> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++-4.4.7-11.el6.x86_64
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-11.el6 will be installed
--> Processing Dependency: cpp = 4.4.7-11.el6 for package: gcc-4.4.7-11.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-11.el6.x86_64
---> Package libstdc++-devel.x86_64 0:4.4.7-11.el6 will be installed
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
--> Running transaction check
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
---> Package cpp.x86_64 0:4.4.7-11.el6 will be installed
--> Running transaction check
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
==============================================================================================
 Package                   Arch             Version                     Repository       Size
==============================================================================================
Installing:
 gcc-c++                   x86_64           4.4.7-11.el6                media           4.7 M
Installing for dependencies:
 cloog-ppl                 x86_64           0.15.7-1.2.el6              media            93 k
 cpp                       x86_64           4.4.7-11.el6                media           3.7 M
 gcc                       x86_64           4.4.7-11.el6                media            10 M
 libstdc++-devel           x86_64           4.4.7-11.el6                media           1.6 M
 mpfr                      x86_64           2.4.1-6.el6                 media           156 k
 ppl                       x86_64           0.10.2-11.el6               media           1.3 M
 
Transaction Summary
==============================================================================================
Install       7 Package(s)
 
Total download size: 22 M
Installed size: 53 M
Is this ok [y/N]: y  
Downloading Packages:
----------------------------------------------------------------------------------------------
Total                                                         163 MB/s |  22 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mpfr-2.4.1-6.el6.x86_64                                                    1/7 
  Installing : cpp-4.4.7-11.el6.x86_64                                                    2/7 
  Installing : ppl-0.10.2-11.el6.x86_64                                                   3/7 
  Installing : cloog-ppl-0.15.7-1.2.el6.x86_64                                            4/7 
  Installing : gcc-4.4.7-11.el6.x86_64                                                    5/7 
  Installing : libstdc++-devel-4.4.7-11.el6.x86_64                                        6/7 
  Installing : gcc-c++-4.4.7-11.el6.x86_64                                                7/7 
  Verifying  : gcc-4.4.7-11.el6.x86_64                                                    1/7 
  Verifying  : gcc-c++-4.4.7-11.el6.x86_64                                                2/7 
  Verifying  : mpfr-2.4.1-6.el6.x86_64                                                    3/7 
  Verifying  : libstdc++-devel-4.4.7-11.el6.x86_64                                        4/7 
  Verifying  : cpp-4.4.7-11.el6.x86_64                                                    5/7 
  Verifying  : ppl-0.10.2-11.el6.x86_64                                                   6/7 
  Verifying  : cloog-ppl-0.15.7-1.2.el6.x86_64                                            7/7 
 
Installed:
  gcc-c++.x86_64 0:4.4.7-11.el6                                                               
 
Dependency Installed:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6     cpp.x86_64 0:4.4.7-11.el6 gcc.x86_64 0:4.4.7-11.el6 
  libstdc++-devel.x86_64 0:4.4.7-11.el6 mpfr.x86_64 0:2.4.1-6.el6 ppl.x86_64 0:0.10.2-11.el6
 
Complete!

原文:http://www.cnblogs.com/kerrycode/p/4748606.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!