C语言 如何将 C 编译器安装到 Eclipse?

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

How to install C Compiler to Eclipse?

ceclipsecompiler-construction

提问by Kovu

I have install the C/C++ CDT Version of Eclipse. After making a HelloWorld.c file and get the code in there I get an error of "Launch failed. Binary not found".

我已经安装了 C/C++ CDT 版本的 Eclipse。制作一个 HelloWorld.c 文件并在其中获取代码后,我收到“启动失败。找不到二进制文件”的错误消息。

I found in google that my Eclipse miss the compiler and I install MinGW on my computer and add the path to env variables (tested it with "gcc -v" in cmd and succeded).

我在谷歌中发现我的 Eclipse 错过了编译器,我在我的计算机上安装了 MinGW 并将路径添加到 env 变量(在 cmd 中使用“gcc -v”进行测试并成功)。

But poorly it get the same Launch Failed error - any ideas, what step I forgot?

但很糟糕,它得到了相同的 Launch Failed 错误 - 任何想法,我忘记了哪一步?

采纳答案by Caladain

Some things to check:
1.) MinGW tools are installed as well. Make sure you have the C compiler and the Make program
2.) Check your Environment variables. Make sure both the compiler and Make are on the path.
3.) Eclipse is a temperamental beast at times, don't lose heart :-)
4.) If you're looking for a good IDE (without care for ideological concerns), might be worth looking at Bloodshed C++ IDE and Visual C++ 2010 express (or whatever they call their free version).
5.) Check the options menu in Eclipse to make sure it's looking at the correct environment variables for finding the Path.

需要检查的一些事项:
1.) 还安装了 MinGW 工具。确保您有 C 编译器和 Make 程序
2.) 检查您的环境变量。确保编译器和 Make 都在路径上。
3.) Eclipse 有时是一个喜怒无常的野兽,不要灰心:-)
4.) 如果您正在寻找一个好的 IDE(不考虑意识形态问题),可能值得一看 Bloodshed C++ IDE 和 Visual C++ 2010 express(或任何他们所谓的免费版本)。
5.) 检查 Eclipse 中的选项菜单,以确保它正在查看用于查找路径的正确环境变量。

回答by soru

IMHO, the simplest setup for eclipse on windows these days is cygwin - it seems to have been updated more recently than mingw, and works better.

恕我直言,这些天在 Windows 上最简单的 eclipse 设置是 cygwin - 它似乎比 mingw 更新得更近,而且效果更好。

Go to http://www.cygwin.com/, download the installer, select the default directory of c:\cygwin. Select 'All users'.

http://www.cygwin.com/下载安装程序,选择默认目录 c:\cygwin。选择“所有用户”。

When it offers a list of packages, select 'gcc', 'binutils' and 'make' under the 'devel' category.

当它提供一个包列表时,在“devel”类别下选择“gcc”、“binutils”和“make”。

Add c:\cygwin\bin to your windows environment PATH.

将 c:\cygwin\bin 添加到您的 Windows 环境 PATH。

回答by Jay

Make sure Eclipse knows where to find your gcc compiler. An easier way would be to use EasyEclipse until you are more comfortable with your dev env.

确保 Eclipse 知道在哪里可以找到您的 gcc 编译器。一种更简单的方法是使用 EasyEclipse,直到您对开发环境更加满意为止。

回答by G O'Rilla

I needed to move from the MinGW gcc to the CygWin gcc - all the C++2011 works and others say it is a better option too. Download the CygWin binaries etc. and then open up Eclipse.

我需要从 MinGW gcc 转移到 CygWin gcc——所有的 C++2011 都可以工作,其他人说这也是一个更好的选择。下载 CygWin 二进制文件等,然后打开 Eclipse。

In project properties, C/C++ Build -> Environment and set the CYGWIN_HOME variable. This worked fine for me on Eclipse Kepler Windows 7 (64Bit)

在项目属性中,C/C++ Build -> Environment 并设置 CYGWIN_HOME 变量。这对我来说在 Eclipse Kepler Windows 7 (64Bit) 上很好用

screen shot of setting environment variable

设置环境变量的屏幕截图

I also put the cygwin bin directory at the front of my Windows PATH variable.

我还将 cygwin bin 目录放在我的 Windows PATH 变量的前面。

Full details here: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fconcepts%2Fcdt_o_home.htm

详细信息在这里:http: //help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fconcepts%2Fcdt_o_home.htm

回答by Kane

You can try installing wascana. It automatically set up GNU compiler for you on Windows.

您可以尝试安装wascana。它会在 Windows 上自动为您设置 GNU 编译器。