c++ - 无法使用 Fedora 中的 g++

标签 c++ unix gcc g++ glibc

$ yum list | grep gcc
arm-gp2x-linux-gcc.i686            4.1.2-11.fc12          @fedora               
arm-gp2x-linux-gcc-c++.i686        4.1.2-11.fc12          @fedora               
gcc.i686                           4.4.3-4.fc12           @updates              
libgcc.i686                        4.4.3-4.fc12           @updates              
avr-gcc.i686                       4.4.2-2.fc12           updates               
avr-gcc-c++.i686                   4.4.2-2.fc12           updates               
compat-gcc-34.i686                 3.4.6-18               fedora                
compat-gcc-34-c++.i686             3.4.6-18               fedora                
compat-gcc-34-g77.i686             3.4.6-18               fedora                
compat-libgcc-296.i686             2.96-143               fedora                
gcc-c++.i686                       4.4.3-4.fc12           updates               
gcc-gfortran.i686                  4.4.3-4.fc12           updates               
gcc-gnat.i686                      4.4.3-4.fc12           updates               
gcc-java.i686                      4.4.3-4.fc12           updates               
gcc-objc.i686                      4.4.3-4.fc12           updates               
gcc-objc++.i686                    4.4.3-4.fc12           updates               
mingw32-gcc.i686                   4.4.1-3.fc12           fedora                
mingw32-gcc-c++.i686               4.4.1-3.fc12           fedora                
mingw32-gcc-gfortran.i686          4.4.1-3.fc12           fedora                
mingw32-gcc-objc.i686              4.4.1-3.fc12           fedora                
mingw32-gcc-objc++.i686            4.4.1-3.fc12           fedora                
msp430-gcc.i686                    3.2.3-3.20090210cvs.fc12
$

gcc 在 .c 文件上工作正常但在 .cpp 文件上失败说:

$ gcc: error trying to exec 'cc1plus': execvp: No such file or directory

g++ 失败说:

$ g++: Command not found.

我应该怎么做才能编译C++文件?

最佳答案

你需要安装gcc-c++包:

yum 安装 gcc-c++

关于c++ - 无法使用 Fedora 中的 g++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2830015/

相关文章:

C++ 排序无法解析标识符的开始和结束?(将数组保持在一起)

c++ - 如何从列文件中有选择地绘制(在 C/C++ 中)

linux - 如果在 shell 中运行 'exec ls' 会发生什么?为什么?

C Fork程序输出解释

c++ - 为什么一个结构有另一个结构作为成员包装在一个 union 中,如果没有显式默认构造函数则不能编译?

c++ - 降低算法的时间复杂度

json - 从 JSON 文件中删除换行符、制表符和回车符等转义序列字符

c - 如何在未对齐的缓冲区中使用结构

c++ - 与库的 c 绑定(bind)链接

gcc - GDB:关于回溯中文件的相对和绝对路径的问题