问题描述
我使用Eclipse Mars和MSYS2. Eclipse无法识别我的MSYS2安装.它包含用于32位编译的Mingw-w64.我在互联网上找到的东西不起作用.我该怎么办?
My I use Eclipse Mars and MSYS2. Eclipse does not recognize my MSYS2 installation. It contains Mingw-w64 for 32 bit compilation. Things I have found on the Internet did not work. What should I do?
推荐答案
晚了一点,但是看起来MSYS2没什么特别的:通常的设置过程与MinGW-w64安装配合使用的Eclipse对我来说很好.
Well, a bit late to the party, but it looks like there is nothing special about MSYS2: the usual procedure of setting up Eclipse to work with MinGW-w64 installation worked for me just fine.
主要问题是,如用于检测MinGW工具链的Eclipse CDT FAQ 试图在PATH
中找到mingw32-gcc.exe
,而MinGW-w64在其bin
目录中仅包含gcc
和i686-w64-mingw32-gcc.exe
,因此只是将MinGW-w64 bin
目录添加到PATH
将不起作用:
The main issue is that as described in Eclipse CDT FAQ to detect MinGW toolchain CDT tries to find mingw32-gcc.exe
in PATH
, while MinGW-w64 have only gcc
and i686-w64-mingw32-gcc.exe
in its bin
directory, so just adding MinGW-w64 bin
directory to PATH
won't work:
正如Eclipse CDT FAQ中进一步提到的那样,简单的解决方法是将i686-w64-mingw32-gcc.exe
复制到mingw32-gcc.exe
:
As it mentioned further in Eclipse CDT FAQ, the easy fix would be to copy i686-w64-mingw32-gcc.exe
to mingw32-gcc.exe
:
完成上述复制后,您可以将MinGW-w64 bin
目录添加到PATH
,Eclipse将把MinGW-w64安装识别为MinGW工具链.由于我不喜欢在Windows设置中不污染系统或用户环境变量的想法,因此我通常编写一个简短的批处理文件,该文件将MinGW-w64 bin
目录添加到PATH
,然后为我启动Eclipse:
After you did the copying described above, you can add MinGW-w64 bin
directory to PATH
and Eclipse will recognize the MinGW-w64 installation as MinGW toolchain. Since I don't like idea of polluting neither system nor user environment variables in Windows settings, I usually write a short batch file which adds MinGW-w64 bin
directory to PATH
and then starts Eclipse for me:
SET PATH=c:\msys32\mingw32\bin;%PATH%
START c:\eclipse\eclipse.exe
这篇关于配置Eclipse以与MSYS2一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!