Eclipse 找不到用于 C/C++ 的 MinGW 工具链

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

Eclipse can't find my MinGW toolchain for C/C++

c++ceclipsemingwtoolchain

提问by Luchnik

I have a problem. Many have the same question but I didn't find the answer.

我有个问题。许多人有同样的问题,但我没有找到答案。

I installed gcc-4.9.0 on my PC but Eclipse won't find it. I used the default installation path:

我在我的 PC 上安装了 gcc-4.9.0,但 Eclipse 找不到它。我使用了默认安装路径:

C:\MinGW

回答by rufushuang

  1. Setting PATH variable, add something like: "C:\Program Files (x86)\mingw-w64\i686-6.2.0-win32-dwarf-rt_v5-rev1\mingw32\bin"
  2. DO COPYgcc.exe to mingw32-gcc.exe in your path above
  1. 设置PATH变量,添加类似:“C:\Program Files (x86)\mingw-w64\i686-6.2.0-win32-dwarf-rt_v5-rev1\mingw32\bin”
  2. 将gcc.exe复制到上面路径中的 mingw32-gcc.exe

For more information, see: http://wiki.eclipse.org/CDT/User/FAQ#I_installed_MinGW_toolchain_on_my_PC_but_Eclipse_won.27t_find_it.

有关更多信息,请参阅:http: //wiki.eclipse.org/CDT/User/FAQ#I_installed_MinGW_toolchain_on_my_PC_but_Eclipse_won.27t_find_it

回答by conib

I also had this problem recently. I had some difficulty getting my Eclipse Luna SR2 4.4.2 running on Win 7 SP1 to see my newly-installed MinGW-w64 but I was able to resolve it by adding a MINGW_HOME environmental variable to my Win 7 installation, and then restarting Eclipse. (I didn't need to restart Windows.)

我最近也有这个问题。让我的 Eclipse Luna SR2 4.4.2 在 Win 7 SP1 上运行以查看我新安装的 MinGW-w64 时遇到了一些困难,但我能够通过将 MINGW_HOME 环境变量添加到我的 Win 7 安装中来解决它,然后重新启动 Eclipse。(我不需要重新启动 Windows。)

In my case, MinGW-w64 had installed itself at "C:Program Files\mingw-w64\x86_64-4.9.2-win32-seh-rt_v4_rev2" and so I needed to set MINGW_HOME to "C:Program Files\mingw-w64\x86_64-4.9.2-win32-seh-rt_v4_rev2\mingw64" so that it would point to the appropriate subdirectories (bin, etc, include, lib, ...).

就我而言,MinGW-w64 已将自身安装在“C:Program Files\mingw-w64\x86_64-4.9.2-win32-seh-rt_v4_rev2”,因此我需要将 MINGW_HOME 设置为“C:Program Files\mingw-w64 \x86_64-4.9.2-win32-seh-rt_v4_rev2\mingw64" 以便它指向适当的子目录(bin 等、include、lib 等)。

In Win 7, environmental variables can be set via the "Environment Variables" button on the Control Panel -> System and Security -> System -> Advanced system settings. I added my MINGW_HOME variable to the "User variables" section.

在Win 7中,可以通过控制面板->系统和安全->系统->高级系统设置上的“环境变量”按钮设置环境变量。我将我的 MINGW_HOME 变量添加到“用户变量”部分。

回答by Meric Ozcan

This steps helped me when I faced the same problem:

当我遇到同样的问题时,这些步骤对我有帮助:

First add the MinGW directory to your path system environment variable as in this link:

首先将 MinGW 目录添加到您的路径系统环境变量中,如下链接所示:

(https://www.youtube.com/watch?v=zLpaYVIoXqc)

( https://www.youtube.com/watch?v=zLpaYVIoXqc)

After this when you want to create a project uncheck "Show project types and toolchains only if they are supported on the platorm" option. Choose MinGW GCC

在此之后,当您要创建项目时,取消选中“仅当平台支持时才显示项目类型和工具链”选项。选择 MinGW GCC

Create your code but first build it with CTRL+B, after this mine worked perfectly.

创建您的代码,但首先使用 CTRL+B 构建它,在此我的工作完美之后。

I wish it will be helpful for other people who see this

我希望它对看到此内容的其他人有所帮助

回答by Kirill

Eclipse uses the system environment variable "PATH" to find a toolchain. So, in order to Eclipse could find MinGW toolchain, the path the to bin-directory of MinGW (e.g. "C:\MinGW\bin") should be specified in the "PATH" environment variable.

Eclipse 使用系统环境变量“PATH”来查找工具链。因此,为了让Eclipse 能够找到MinGW 工具链,需要在“PATH”环境变量中指定MinGW 的bin 目录的路径(例如“C:\MinGW\bin”)。

P.S. And don't forget to re-launch Eclipse after modifying the environment variable :)

PS 并且不要忘记修改环境变量后重新启动Eclipse :)

回答by user2972287

I had this problem for a while and just now got it to work.
Here's what I did:
In Eclipse, go to Window>Preferences>C/C++>Build>Environment. Double click the row that has PATH in the leftmost column to open the list. Make sureyou've got \bin at the end of your C:\MinGW in that list. Mine didn't have the \bin. I changed it to read C:\MinGW\bin and now it works like a charm.
Hope this helps.

我有一段时间有这个问题,现在才开始工作。
这是我所做的:
在 Eclipse 中,转到 Window>Preferences>C/C++>Build>Environment。双击最左侧列中包含 PATH 的行以打开列表。确保在该列表中的 C:\MinGW 末尾有 \bin。我的没有\bin。我把它改成 C:\MinGW\bin ,现在它就像一个魅力。
希望这可以帮助。

回答by Md. Nahidul Alam Chowdhury

After updating the environment path variable, you must restart os.

更新环境路径变量后,必须重启os。