eclipse 无法找到完整路径 g++ 和 gcc
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25235523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unable to find full path g++ and gcc
提问by user3306996
I am trying to install Eclipse Helios on Linux and I manage to get eclipse installed. However, upon running a simple hello world program, errors occurred. It says unable to find full path for g++ and gcc and thus I am unable to run the program.
我正在尝试在 Linux 上安装 Eclipse Helios,并且我设法安装了 Eclipse。但是,在运行一个简单的 hello world 程序时,发生了错误。它说无法找到 g++ 和 gcc 的完整路径,因此我无法运行该程序。
Does it got to do with my linux installation or eclipse installation? Please advice. Thank you.
它与我的 linux 安装或 eclipse 安装有关吗?请指教。谢谢你。
采纳答案by Ronak Jain
Okay, Possibilities are either you didn't installed g++ before (or after) installing eclipse or the path was not detected by eclipse. Since Eclipse's installation itself does not include g++ you need to install it separately using terminal.
好的,可能是您在安装 eclipse 之前(或之后)没有安装 g++,或者 eclipse 未检测到路径。由于 Eclipse 的安装本身不包含 g++,因此您需要使用终端单独安装它。
Also as you didn't mention which Linux are you on, I am assuming Ubuntu/Debian.Now you need to check whether g++ is installed or not on your system.To do this: Open Terminal by pressing CTRL+ALT+T and then enter the following command
此外,由于您没有提到您使用的是哪个 Linux,我假设您使用的是 Ubuntu/Debian。现在您需要检查您的系统上是否安装了 g++。为此:按 CTRL+ALT+T 打开终端,然后输入以下命令
g++ <some c++ filename and path> -o output
and press enter.If it compiles that means G++ is installed else it'll say command not found.In case you don't have g++ installed use this command (this is ONLY for UBUNTU and its derivatives)`
然后按回车。如果它编译意味着安装了 G++,否则它会说找不到命令。如果你没有安装 g++,请使用这个命令(这仅适用于 UBUNTU 及其衍生产品)`
sudo apt-get install g++
Also in case of previous broken installation, first use this command`
同样在以前安装损坏的情况下,首先使用此命令`
sudo apt-get autoremove g++
and then install! Now to get the path of the newly installed compiler use this
然后安装!现在要获取新安装的编译器的路径,请使用它
$ which g++
and put the output path in Eclipse preferences
并将输出路径放在 Eclipse 首选项中
回答by Kamyar Ghasemlou
first of all title is misleading, i will recommend to change it to get better answers. check where your g++ and gcc executable are located: Terminal:
首先,标题具有误导性,我会建议更改它以获得更好的答案。检查您的 g++ 和 gcc 可执行文件所在的位置:终端:
$ which g++
$ which gcc
output is likely gooing to be:
输出很可能是:
/usr/bin/g++
/usr/bin/g++
and
和
/usr/bin/g++
/usr/bin/g++
(in this point if you get a path for gcc/g++ your linux installation is likely ok and eclipse can't find gcc and g++)
(在这一点上,如果您获得 gcc/g++ 的路径,则您的 linux 安装可能没问题,并且 eclipse 找不到 gcc 和 g++)
then go to eclipse yourProject > properties and set path/command for gcc and g++.
然后转到 eclipse yourProject > properties 并为 gcc 和 g++ 设置路径/命令。
回答by Will
On RHEL 7.3 you can do this to install the 64-bit gcc/g++
compiler:
在 RHEL 7.3 上,您可以执行以下操作来安装 64 位gcc/g++
编译器:
$ yum install gcc-c++.x86_64
$ g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
回答by ivo
Have you installed gcc? If you have installed, maybe you should configurate eclipse? It might be the problem.
你安装gcc了吗?如果你已经安装,也许你应该配置eclipse?这可能是问题所在。