Programming with MinGW and MSYS
Lets say you’re a programmer who enjoys the GNU environment, and you’ve become pretty good friends with gcc and g++. However, for one reason or another, you need to write a program in C++ on your Windows box. You find yourself uninterested in using Microsoft’s compiler, and you wish you could just have gcc and g++ back. The good news is you can have them both, and more, with MinGW and MSYS! This tutorial will guide you through installing these tools.
This tutorial assumes you have experience editing environment variables in a Windows environment. If you’re not familiar with the process, see Microsoft’s tutorial on how to edit environment variables in Windows XP.
Step 1: Download
To get started, download the packages listed below. In a nutshell, MinGW will provide you with gcc and g++. MSYS provides you with old favorites like ./configure, make, and make install.
- Download MinGW-5.1.3.exe
- Download MSYS-1.0.10.exe
Step2: Install MinGW
Once those downloads have completed you need to install them (of course). Start with MinGW.
- Run MinGW-5.1.3.exe
- Follow the standard wizard installation process.
- Select Download and install.
- Select the Current package.
- Choose a Full install.
- Choose a folder to install MinGW into. I used C:\apps\mingw.
- The installer will now download and install the packages you selected. It might take a few minutes, depending on your connection speed, so go browse the news for a bit.
- Add $MINGW_HOME\bin to your PATH variable (where $MINGW_HOME is the directory you chose to install to).
- Open up a shell and type gcc. You should see the output gcc: no input files if you got everything setup correctly.
Step 3: Install MSYS
MSYS will top off your GNU environment. You’ll be able to build packages using the familiar ./configure, make, make install flow.
- Run MSYS-1.0.10.exe
- Follow the standard wizard procedure
- Choose a folder to install MSYS to. I used C:\apps\msys\1.0.
- Choose the platform you want to use. You will probably only have one option for i386 machines, assuming you’re on a pretty basic machine.
- Here comes the fancy part. Once the install has run, a shell will pop up asking you if you want to perform some post install processing. Type yes.
- You will be asked if you have MinGW installed. Type yes again.
- After the next prompt, hit Enter. The post processor will “normalize” your MinGW environment.
- Finally, you will receive an alert warning you about an old version of make.exe that ships with MinGW-1.1. You should not have to worry about this, seeing as you have (theoretically) installed a newer version. Just hit Enter.
- The install process should now be complete.
If everything went smoothly, you should find a squiggly looking “M” icon on your desktop. Just double click it an you’ll bring up an MSYS environment. You’ll be able to navigate around using Linux style commands. Furthermore, you’ll now have ./configure and make capabilities.
You’re Done
Congratulations, you now have a GNU style coding environment.