Install
Start the Installer as for any other Windows program.
Choose the default package (Current).
Choose "Minimal" install type if you want to install only gcc, choose "Custom" or "Full" if you want to install additional components such as g++ and/or MinGW make (you can always re-run the installer later to add these components).
Configure
MinGW is installed by default in the folder C:\MinGW.
Add this path to the PATH Environment variable:
Start -> Control Panel -> System -> Advanced -> Environment Variables
In the System variables section, select the Path variable, clic Edit, and add
;C:\MinGW\bin
at the end (no spaces).
Note: If you already installed UnxUtils and added its path to PATH, you should better put ;C:\MinGW\binbefore;C:\unxutils\bin\, as some of the tools exists both in MinGW and UnxUtils, but where MinGW normally uses more recent versions.
Now open a Command Line window (if you already had a Command Line window opened, you have to close and open it again, as the PATH changes doesn't apply to already running applications).
Compile and run
Type gcc and you should see
gcc: no input files
Create a file simple.c:
/*
* The simplest Windows program you will ever write.
*
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
*
* Colin Peters <colinpeters at geocities.com>, June 9, 1998.
*/#include<windows.h>intSTDCALL
WinMain (HINSTANCEhInst, HINSTANCEhPrev, LPSTRlpCmd, intnShow)
{
MessageBox (NULL, "Hello, Windows!", "Hello", MB_OK);
return 0;
}
Compile simple.c and run simple.exe in a Command Line window:
Additional tools
If you haven't done so already, you may install Emacs and/or UnxUtils to get a more UNIX-like development environment on your Windows box.