In this little tutorial, we'll be installing some UNIX programs by means of the "Minimal GNU for Windows" suite (MinGW for short) for Windows 7 and up. First, let's get MinGW.
- Go to the Sourceforge project page for MinGW32 or MinGW64, and download.
- Install in a directory of choice (I personally chose
C:/Users/[name]/AppData/Local/MinGW
, to not have to install underC:/
but to have it hidden somewhere with write privileges). Note: MinGW64 requires you select an architecture. You'll want to go forx86_64
. - Browse to Computer -> Properties -> Advanced -> Environmental Variables -> User Variables, and edit the
PATH
variable by appending the path of your MinGW'sbin/
folder. For MinGW32, this is;C:\Users\[name]\AppData\Local\MinGW\bin;
. For MinGW64, the path should look a little more elaborate.
That's it for MinGW. For MinGW64, gcc
should now already be available (after reopening the command prompt). For MinGW32, we now have access to a command-line package installer for various UNIX toolkits. To install the GNU C Compiler (GCC):
- Open Windows's
cmd
. - Execute
mingw-get install gcc
.
That's it! For this course, you'll need some other utilities. You can get them by specifying each separately, or all at once as we've done below.
mingw-get install mingw-developer-toolkit msys-base mingw32-base
You are now all set up for compiling C on Windows!