在路径中找不到 Eclipse 错误“g++/gcc”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16191116/
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
Eclipse error 'g++/gcc' not found in path
提问by Devolus
I have installed Eclipse 4.3 Juno. My environment is split into two separate workspaces. One is for Java and one for c/c++.
我已经安装了 Eclipse 4.3 Juno。我的环境分为两个独立的工作区。一种用于 Java,一种用于 c/c++。
When I run the eclipse for C I can work with it and compile my projects.
当我为 CI 运行 Eclipse 时,可以使用它并编译我的项目。
eclipse -data d:\src\c -vmargs -Xmx512M
Now when I run the environment for Java development I suddenly get this error:
现在,当我运行 Java 开发环境时,我突然收到此错误:
error 'g++/gcc' not found in path
The two workspaces are completely separated with their own .metadata directories.
这两个工作区通过它们自己的 .metadata 目录完全分开。
I tried various hints that I found here and via google, like resetting the preferences, but nothing helped. Since I can work with my C environment it should be proof enough that the compiler exists. :) It is also in the PATH variable, so when I use g++/gcc on the windows commandproampt I get access denied (because it's cygwin).
我尝试了在这里和通过谷歌找到的各种提示,比如重置首选项,但没有任何帮助。因为我可以在我的 C 环境中工作,所以应该足以证明编译器存在。:) 它也在 PATH 变量中,所以当我在 windows commandproampt 上使用 g++/gcc 时,我的访问被拒绝(因为它是 cygwin)。
So How can I get rid of this annoying error when I run my eclipse only for Java. I don't even need CDT there, but the plugins are probably installed in eclipse and not in the workspace. So this has to be some path setting or so, which I changed for the C but not for the Java environment.
那么当我只为 Java 运行我的 eclipse 时,我怎样才能摆脱这个烦人的错误。我什至不需要 CDT,但插件可能安装在 eclipse 中而不是工作区中。所以这必须是一些路径设置左右,我为 C 而不是为 Java 环境更改了它。
采纳答案by Devolus
So finally I found a solution. I got the hint from here Configure Eclipse CDT to use g++
所以最后我找到了解决方案。我从这里得到提示Configure Eclipse CDT to use g++
The important bit was the comment that g++ is a symbolic link. Everything was set up ok, but when I executed g++ or gcc from the windows command prompt, I got the error "Access denied" while it worked from within cygwin.
重要的一点是 g++ 是一个符号链接的注释。一切都设置好了,但是当我从 Windows 命令提示符执行 g++ 或 gcc 时,我在 cygwin 中工作时收到错误“拒绝访问”。
After reading the bit about it being a symbolic link, it was clear what the problam was, because Windows can not cope with it. So what I did now, I reversed the symbolic links such that gcc and g++ is the real exe and the links of g++-3 and so on are pointing now to the exe, instead of the other way around.
在阅读了关于它是一个符号链接的部分之后,很清楚问题是什么,因为 Windows 无法处理它。所以我现在所做的,我反转了符号链接,使得 gcc 和 g++ 是真正的 exe,而 g++-3 等的链接现在指向 exe,而不是相反。
I had to restart eclipse using the -clean option, then restarted it normaly and the error is history. :D
我不得不使用 -clean 选项重新启动 eclipse,然后正常重新启动它,错误是历史记录。:D
回答by Luke Clifford
You should install the build-essential
您应该安装 build-essential
sudo apt-get install build-essential
after installing this, open a terminal, and type g++ (hit enter) if it says there is no input, then you got your g++
安装后,打开一个终端,输入 g++(按回车键),如果它说没有输入,那么你得到了你的 g++
I mean, eclipse is good but problems like this are persistent I find.
我的意思是,eclipse 很好,但我发现这样的问题一直存在。
Try giving NetBeans a look in.
尝试让 NetBeans 看看。