配置Eclipse以与MSYS2一起使用 [英] Configuring Eclipse for using with MSYS2

查看:391
本文介绍了配置Eclipse以与MSYS2一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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目录中仅包含gcci686-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:

尽管PATH上有g ++.exe或gcc.exe并已定义 MINGW_HOME,您可能仍然会收到工具链"MinGW GCC"不是 检测到"消息(Luna 4.4.0上的CDT 8.4).确保一个文件 名为"mingw32-gcc.exe"的文件存在于MINGW_HOME \ bin中.

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.

正如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中),请复制-gcc.exe文件(例如 i686-w64-mingw32-gcc.exe)到mingw32-gcc.exe.如果是可怕的消息 仍然流连忘返,重新启动系统(不只是注销和 登录).

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).

完成上述复制后,您可以将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一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆