Eclipse CDT 找不到 Cygwin 或 MinGW 工具链

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

Eclipse CDT does not find either Cygwin or MinGW toolchain

eclipsecygwinmingweclipse-cdttoolchain

提问by Mr.

I am having hard times to configure Eclipse Juno to for C/C++. I am a Windows user, so I have installed Cygwinand MinGW, and CDTunder Eclipse. Also configured the PATHvariable correctly, though I still do not have any new toolchain in Eclipse C/C++ new project.

我很难为 C/C++ 配置 Eclipse Juno。我是一个Windows用户,所以我已经安装CygwinMinGW,并CDT在Eclipse中。还PATH正确配置了变量,尽管我在 Eclipse C/C++ 新项目中仍然没有任何新工具链。

These are my Eclipse details:

这些是我的 Eclipse 详细信息:

Eclipse Java EE IDE for Web Developers.

Version: Juno Release
Build id: 20120614-1722

Also, see image of installed component of Eclipse. Installed components in EclipseEnclosed some outout from Windows command line:

另外,请参阅已安装 Eclipse 组件的图像。 在 Eclipse 中安装的组件附上一些来自 Windows 命令行的输出:

C:\>echo %path%
C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x8
6)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\
Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Fil
es (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\MiKTeX 2.9\miktex
\bin\x64\;C:\Program Files\MATLAB\R2011b\runtime\win64;C:\Program Files\MATLAB\R
2011b\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Java\jdk\b
in;C:\Program Files (x86)\Java\jre\bin;C:\Program Files (x86)\Android\android-sd
k\platform-tools;C:\Program Files (x86)\Android\android-sdk\tools;C:\Program Fil
es\Python32;C:\Program Files (x86)\Notepad++;C:\tomcat\bin;C:\Users\Administrato
r\AppData\Roaming\npm;C:\Program Files (x86)\Gnu\GnuWin32\bin;C:\Program Files\n
odejs;C:\Users\Administrator\AppData\Roaming\npm;C:\MinGW\bin;C:\MSYS\bin;C:\cyg
win\bin

C:\>gdb --version
GNU gdb (GDB) 7.4
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.    

C:\>make --version
GNU Make 3.81
Copyright (C) 2006  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.

This program built for i386-pc-mingw32

C:\>g++ --version
g++ (GCC) 4.7.0
Copyright (C) 2012 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.

C:\>gcc --version
gcc (GCC) 4.7.0
Copyright (C) 2012 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.

Enclosed output from Cygwin shell:

Cygwin shell 的封闭输出:

Cygwin Package Information
Package                   Version              Status
_autorebase               000085-1             OK
_update-info-dir          01054-1              OK
alternatives              1.3.30c-10           OK
autoconf                  10-1                 OK
autoconf2.1               2.13-10              OK
autoconf2.5               2.68-1               OK
automake1.9               1.9.6-10             OK
base-cygwin               3.1-1                OK
base-files                4.1-1                OK
bash                      4.1.10-4             OK
binutils                  2.22.51-2            OK
bzip2                     1.0.6-2              OK
colorgcc                  1.3.2-2              OK
coreutils                 8.15-1               OK
crypt                     1.2-1                OK
cygutils                  1.4.10-2             OK
cygwin                    1.7.15-1             OK
cygwin-doc                1.7-1                OK
dash                      0.5.7-1              OK
dejagnu                   20021217-2           OK
diffutils                 3.2-1                OK
dos2unix                  6.0-1                OK
editrights                1.01-2               OK
expect                    5.45-1               OK
file                      5.11-1               OK
findutils                 4.5.9-2              OK
gawk                      4.0.1-1              OK
gcc                       3.4.4-999            OK
gcc-core                  3.4.4-999            OK
gcc-g++                   3.4.4-999            OK
gcc-mingw                 20040810-1           OK
gcc-mingw-core            20050522-3           OK
gcc-mingw-g++             20050522-3           OK
gcc-tools-epoch1-autoconf 2.59-1               OK
gcc-tools-epoch1-automake 1.9.6-1              OK
gcc-tools-epoch2-autoconf 2.64-1               OK
gcc-tools-epoch2-automake 1.11.1-1             OK
gcc4                      4.5.3-3              OK
gcc4-core                 4.5.3-3              OK
gcc4-g++                  4.5.3-3              OK
gdb                       7.3.50-3             OK
gdbm                      1.8.3-20             OK
gettext                   0.18.1.1-2           OK
grep                      2.6.3-1              OK
groff                     1.21-2               OK
gzip                      1.4-1                OK
ipc-utils                 1.0-1                OK
less                      444-1                OK
libattr1                  2.4.46-1             OK
libbz2_1                  1.0.6-2              OK
libcloog0                 0.15.7-1             OK
libdb4.5                  4.5.20.2-3           OK
libffi4                   4.5.3-3              OK
libgcc1                   4.5.3-3              OK
libgdbm                   1.8.0-5              OK
libgdbm-devel             1.8.3-20             OK
libgdbm4                  1.8.3-8              OK
libgmp3                   4.3.2-1              OK
libgmpxx4                 4.3.2-1              OK
libgomp1                  4.5.3-3              OK
libiconv2                 1.14-2               OK
libintl3                  0.14.5-1             OK
libintl8                  0.18.1.1-2           OK
liblzma5                  5.0.2_20110517-1     OK
libmpc1                   0.8-1                OK
libmpfr1                  2.4.1-4              OK
libmpfr4                  3.0.1-1              OK
libncurses10              5.7-18               OK
libncurses9               5.7-16               OK
libncursesw10             5.7-18               OK
libpcre0                  8.21-2               OK
libpopt0                  1.6.4-4              OK
libppl                    0.10.2-1             OK
libreadline7              6.1.2-3              OK
libsigsegv2               2.10-1               OK
libssp0                   4.5.3-3              OK
libstdc++6                4.5.3-3              OK
libstdc++6-devel          4.5.3-3              OK
login                     1.10-10              OK
m4                        1.4.16-1             OK
make                      3.82.90-1            OK
man                       1.6g-1               OK
mingw-binutils            2.21-1               OK
mingw-gcc-core            4.5.2-1              OK
mingw-gcc-g++             4.5.2-1              OK
mingw-pthreads            20110507-1           OK
mingw-runtime             3.20-1               OK
mingw-w32api              3.17-2               OK
mingw64-i686-binutils     2.22.52-1            OK
mingw64-i686-gcc          4.5.3-6              OK
mingw64-i686-gcc-core     4.5.3-6              OK
mingw64-i686-gcc-g++      4.5.3-6              OK
mingw64-i686-headers      3.0b_svn5134-1       OK
mingw64-i686-pthreads     20100619-4           OK
mingw64-i686-runtime      3.0b_svn5134-1       OK
mingw64-x86_64-binutils   2.22.52-1            OK
mingw64-x86_64-gcc        4.5.3-6              OK
mingw64-x86_64-gcc-core   4.5.3-6              OK
mingw64-x86_64-gcc-g++    4.5.3-6              OK
mingw64-x86_64-headers    3.0b_svn5134-1       OK
mingw64-x86_64-pthreads   20100619-4           OK
mingw64-x86_64-runtime    3.0b_svn5134-1       OK
mintty                    1.1.1-1              OK
perl                      5.10.1-5             OK
rebase                    4.2.0-1              OK
run                       1.1.13-1             OK
sed                       4.2.1-2              OK
tar                       1.25-1               OK
tcl                       8.5.11-1             OK
terminfo                  5.7_20091114-14      OK
texinfo                   4.13-4               OK
tzcode                    2012b-1              OK
w32api                    3.17-2               OK
which                     2.20-2               OK
xz                        5.0.2_20110517-1     OK
zlib0                     1.2.7-1              OK

I am also familiar with Why doesn't MinGW show up in the list of Eclipse/Indigo CDT Toolchains?and How to deal with Eclipse CDT+Cygwin?and http://wyding.blogspot.com/2009/04/setup-cygwin-toolchain-in-eclipse-cdt.html

我也熟悉为什么 MinGW 没有出现在 Eclipse/Indigo CDT 工具链列表中?以及如何处理 Eclipse CDT+Cygwin?http://wyding.blogspot.com/2009/04/setup-cygwin-toolchain-in-eclipse-cdt.html

Could anyone help me realize what is wrong?

任何人都可以帮助我意识到出了什么问题吗?

回答by nasta

I have the same problem. I have found two possible solutions:

我也有同样的问题。我找到了两种可能的解决方案:

  1. Uncheck "Show project types and toolchains only if they are supported on the platform" when you choose "New Project->C++ Project->Project Type: Executable".

  2. Uninstall the "GNU Autotools", then you can see options that you want.

  1. 选择“新建项目->C++ 项目->项目类型:可执行文件”时,取消选中“仅当平台支持时才显示项目类型和工具链”。

  2. 卸载“GNU Autotools”,然后您可以看到您想要的选项。

回答by Dustin Scott

Per the CDT help page: http://wiki.eclipse.org/CDT/User/FAQ#I_installed_MinGW_toolchain_on_my_PC_but_Eclipse_won.27t_find_it.

根据 CDT 帮助页面:http: //wiki.eclipse.org/CDT/User/FAQ#I_installed_MinGW_toolchain_on_my_PC_but_Eclipse_won.27t_find_it

Despite having g++.exe or gcc.exe on your PATH and having defined MINGW_HOME, you may still get a “Toolchain "MinGW GCC" is not detected” message (CDT 8.4 on Luna 4.4.0). Make sure that a file called "mingw32-gcc.exe" exists in MINGW_HOME\bin. If it doesn't exist (which happens with MinGW-W64), copy a -gcc.exe file (e.g. i686-w64-mingw32-gcc.exe) to mingw32-gcc.exe. If the dreaded message still lingers around, reboot your system (don't just logout and login).

尽管您的 PATH 上有 g++.exe 或 gcc.exe 并定义了 MINGW_HOME,您仍然可能会收到“未检测到工具链“MinGW GCC””消息(Luna 4.4.0 上的 CDT 8.4)。确保 MINGW_HOME\bin 中存在名为“mingw32-gcc.exe”的文件。如果它不存在(MinGW-W64 会发生这种情况),请将 -gcc.exe 文件(例如 i686-w64-mingw32-gcc.exe)复制到 mingw32-gcc.exe。如果可怕的消息仍然存在,请重新启动系统(不要只是注销和登录)。

回答by john smith

I had the same problem. I fixed it by adding the location of my cygwin compiler programs to PATH. Maby you did not properly add the location. For cygwin, have the path go to the bin folder.

我有同样的问题。我通过将我的 cygwin 编译器程序的位置添加到 PATH 来修复它。可能您没有正确添加位置。对于 cygwin,将路径转到 bin 文件夹。

回答by sergiomse

Eclipse tries to figure out where is cygwin1.dll. But this file is in many programs previously built with cygwin. So Eclipse could find this before the right cygwin installed.

Eclipse 试图找出 cygwin1.dll 在哪里。但是这个文件在许多以前用 cygwin 构建的程序中。因此 Eclipse 可以在安装正确的 cygwin 之前找到它。

So a possible solution could be to put the C:\cygwin\bin at the begining of the PATH variable, so Eclipse searches there before.

因此,一个可能的解决方案是将 C:\cygwin\bin 放在 PATH 变量的开头,以便 Eclipse 之前在那里搜索。

回答by iloo

I couldn't make the Eclipse (LUNA) locate MinGW on my computer (there were no MinGW available in Preferences>C/C++/New C/C++ Project Wizard) even after I have specified PATH as "C:\MinGW\bin" in Preferences>C/C++/Build>Environment, so what I did afterwards was:

即使在我将 PATH 指定为“C:\MinGW\bin”之后,我也无法让 Eclipse (LUNA) 在我的计算机上找到 MinGW(在Preferences>C/C++/New C/C++ Project Wizard中没有可用的MinGW)在Preferences>C/C++/Build>Environment,所以我之后做的是:

  1. Create a simple "Hello world" C project without specifying any toolchains
  2. (at this step I tried to Build All, and it failed)
  3. Go to Project>Properties, suprisingly, here I could see MinGW GCC as an available choice for Current toolchain. Select it.
  4. Now I could build and run the project
  1. 创建一个简单的“Hello world”C 项目而不指定任何工具链
  2. (在这一步我尝试构建所有,但失败了)
  3. 转到Project>Properties,令人惊讶的是,在这里我可以看到 MinGW GCC 作为当前工具链的可用选择。选择它。
  4. 现在我可以构建和运行项目

Hopefully, it helps!

希望它有帮助!