使用 Eclipse CDT 在 PATH 中找不到程序“gcc”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12753011/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:08:43  来源:igfitidea点击:

Program "gcc" not found in PATH with Eclipse CDT

ceclipsegcceclipse-cdt

提问by anon_nerd

I cannot seem to figure out how to use Eclipse CDT.

我似乎无法弄清楚如何使用 Eclipse CDT。

I am on Mac OS X, and am trying to print "Hello World" in C but I get an error:

我在 Mac OS X 上,试图用 C 打印“Hello World”,但出现错误:

Program "gcc" not found in PATH.

在 PATH 中找不到程序“gcc”。

What can I do to use C in Eclipse?

如何在 Eclipse 中使用 C?

回答by Rob

I had the same problem. It may be because you don't have GCC compiler installed on your computer.

我有同样的问题。这可能是因为您的计算机上没有安装 GCC 编译器。

On OSX, you just have to open the Terminal and check which gcc. If it doesn't return a path, then install GCC from here.

在 OSX 上,您只需要打开终端并检查which gcc. 如果它没有返回路径,则从这里安装 GCC

Once installed, this command should return the path :

安装后,此命令应返回路径:

Looking for GCC in OSX Terminal

在 OSX 终端中寻找 GCC

I just had to restart Eclipse and everything worked well then.

我只需要重新启动 Eclipse,然后一切正常。

回答by Shashank Saxena

This is how i got rid of it.

这就是我摆脱它的方式。

Install the MinGW. Select all files in the Basic Setup and select apply the changes. Select new C++ Project You will be able to see "MinGW GCC" in the toolchain section select the same and create project.

安装 MinGW。选择基本设置中的所有文件,然后选择应用更改。选择新的 C++ 项目您将能够在工具链部分看到“MinGW GCC”,选择相同的并创建项目。

回答by Antarr Byrd

Have you installed XCodeon your machine

您是否在您的机器上安装了XCode

updateI would suggest following this tutorialto install brew. You can skip the ruby part if you don't need it.

更新我建议按照本教程安装 brew。如果不需要,可以跳过 ruby​​ 部分。