Compiling GTK applications for Windows

The goal here is to set up a command line compilation environment on Windows so that GTK apps can be compiled, provided they have no other dependencies. These instructions are sufficient to compile the NTW Client (requires GTK) and Server (no dependencies other than MinGW and Win32 libraries).

  1. Download the Current MinGW and MSYS installers (MinGW-some-version.exe and MSYS-some-version.exe) from the MinGW web site. These are the only two files required from this site.
  2. Install MinGW first, preferably to the default C:\MinGW directory. For NTW, you'll only need the C/C++ compilers, but you might like to also install others for compiling other projects.
  3. Install MSYS after MinGW. The command line program will run after the installation and ask you for the directory location of MinGW. This must be filled in as specified. Be careful to use the correct slash.
  4. Now you'll have a complete terminal, compiler and make system. There should be an MSYS icon on the desktop, you can open the terminal and try compiling a basic "hello world" C program to test everything.
  5. Download five files from Tor Lillqvist's site. You'll need all of the Gtk development headers (version numbers may have changed, grab the latest):

      As well as the gnu gettext library:

  6. All of these are zip files that extract to a hypothetical root directory, which in our case should be C:\MinGW. So extract those five zip files to C:\MinGW as they are.
  7. The compilation environment should now be fully functional and ready to compile NTW. Extract the NTW source to the MSYS home directory, which by default is C:\msys\1.0\home\YourUserName\.
  8. Open msys and cd to the ntw/Server or ntw/Client directory, and compile by typing "make -f Makefile.mingw"

If you prefer to use a GUI IDE, Dev-C++ has versions that include MinGW. You'd basically do the same thing with the five zip files, but they'd be extracted to the MinGW directory in Dev-Cpp. You'll also have to set up the Dev-C++ compiler options to include the directories that are created. You can find out exactly what these directories are by looking at the file in the NTW source code.