无法使用 g++来自软呢帽
$ 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:尝试执行“cc1plus”时出错: execvp:没有这样的文件或目录
g++ 失败并提示:
$ g++:未找到命令。
我应该怎么做才能编译 C++ 文件?
$ 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 works fine on .c files but fails on .cpp files saying:
$ gcc: error trying to exec 'cc1plus':
execvp: No such file or directory
g++ fails saying:
$ g++: Command not found.
What should I do to be able to compile C++ files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
gcc-c++ 未安装。
yum list
命令显示所有软件包,而不仅仅是已安装的软件包。安装的软件包以与号或“@”符号为前缀。未安装(但可以安装)的软件包缺少 & 符号。要查看安装的内容,请尝试命令
rpm -qa
。或者在您的示例中rpm -qa | grep gcc
奇怪的是,如果您不只是 grep for gcc,您将能够看到两组之间的“已安装的软件包”和“可用的软件包”输出行。
gcc-c++ is not installed.
The
yum list
command shows all packages, not just the installed packages. The packages that are installed are prefixed with an ampersand or "@" sign. The packages that are not installed (but are available to be installed) lack the ampersand.To see what is installed try the command
rpm -qa
. Or in your examplerpm -qa | grep gcc
Oddly enough, if you didn't just grep for gcc, you would have been able to see the "Installed packages" and "Available packages" output lines between the two sets.
您需要安装 gcc-c++ 软件包:
yum install gcc-c++
you need to install the gcc-c++ package:
yum install gcc-c++