Configuring Eclipse for using with MSYS2

后端 未结 2 827
野性不改
野性不改 2021-01-14 10:37

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

相关标签:
2条回答
  • 2021-01-14 11:00

    Even more later to the party - for me worked this solution: Right click project -> Properties -> C/C++ Build -> Environment: set environment variable MINGW_HOME to C:/.../msys64/mingw64 click OK, and rest is automatically done by eclipse

    0 讨论(0)
  • 2021-01-14 11:05

    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.

    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:

    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.

    As it mentioned further in Eclipse CDT FAQ, the easy fix would be to copy i686-w64-mingw32-gcc.exe to 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).

    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
    
    0 讨论(0)
提交回复
热议问题