How to install MinGW, MSYS and Eclipse on windows

Notes

This is a short guide on how to install MinGW and MSYS using the latest stable. This guide has been updated on 21/12/2011

Requirements

Installing the MinGW and Msys

  • Run mingw-get-inst-20111118.exe
  • Choose “Download latest repository catalogues”
  • Accept the license agreement
  • Use the default folder (C:\MinGW)
  • When asked to select the components, choose: C Compiler, C++ Compiler, MSYS Basic System and MinGW Developer Toolkit.
  • Add C:\MinGW\bin;C:\MinGW\msys\1.0\bin; to your PATH system variables (at the beginning).
  • Done.
Check if your PATH system variables look something like this:

Install the IDE

  • Install the JRE with the default settings
  • To install eclipse, unzip the content to C:\Program Files\eclipse
  • Create a shortcut to Eclipse.exe on the desktop
  • Done.

Creating a HelloWorld Project

  • Open up Eclipse
  • File > New > Project
  • Select C/C++ > C++ Project
  • Click on Next
  • Change project name to “Hello World”
  • Click on Hello World C++ Project (Toolchain should show MinGW GCC)
  • Click Finish
  • On the left side, right click on your project (in the Project Explorer)
  • Choose Build Project
  • Run > Run (or Run > Debug)
  • The Console (at the bottom) should show !!!Hello World!!!
  • You’re all set.

Optional packages to install (use the MinGW console)

mingw-get install msys-wget
mingw-get install msys-zip
mingw-get install msys-unzip

Additional resources

9 Comment

    Frank Henard

    Why is the jdk required?

    12 May 2010 | Reply

    • Actually, that’s my mistake, the Java runtime should be enough (It’s for Eclipse)

      12 May 2010 | Reply

  1. Lukas

    Have you compiled new OSG version 3.0.1 with MinGW ? do you have binariers ?

    23 Sep 2011 | Reply

    • Haven’t tried it yet, but I think the procedure should be the same.

      12 Oct 2011 | Reply

  2. Guillaume

    I archieve the tutorial.
    Mingw is working well (I succeed to compile a program using windows cmd.exe). I created a new project (with the c language instead of c++) , toolchain showed Mingw gcc. But when i tried to run (ctrl F11) a error message appeared : Launch Fail Binary not Found.

    19 Jun 2012 | Reply

    • Can you check with windows explorer if the binary is created properly? Maybe eclipse uses the wrong path when trying to launch the executable.

      20 Jun 2012 | Reply

    • I had the same, I did a few things and then I didn’t get the error anymore.

      1) closed all other projects: right-mouse on this project and select ‘Close Unrelated Projects’. Not sure if this one’s relevant but I had a number of Java projects opened so who knows
      2) “Project>> Clean…” >> clean all
      3) “Project>> Build All”

      That fixed Guillame’s error (which I was having too). I do think that there’s still something not going 100% right. This is the output in the Console now:

      —————————————————————

      **** Build of configuration Debug for project hellocplusplus ****

      **** Internal Builder is used for build ****
      Nothing to build for hellocplusplus

      —————————————————————

      Any ideas?

      13 Aug 2012 | Reply

      • I’ve updated the guide, seems like it doesn’t autobuild the binary. Just select your project on the left side, rightclick it and hit build project. That will give you a working binary.

        14 Aug 2012 | Reply

    • Matt

      I also had this problem. To fix, I reinstalled mingw and chose the option to download the latest builds during the install and installed the optional things with mingw console.

      07 Oct 2012 | Reply

    Leave a reply