.

Back to GettingStarted, Up to HomePage.

How to use Glade with MinGW in Windows 98

Contributed by ChrisLale.

Glade is a great GUI builder. There is a win32 version called Glade for Windows. Its project files are interchangeable with the Linux version of Glade.

Here is a guide to setting up and using Glade with MinGW in Windows 98. If you have any experience of successfully using Glade with MinGW in other versions of Windows, please add that information at the bottom of this page.

This document describes how to install MinGW, Msys, MsysDTK and Gladewin32, and how to compile a Glade project on a Windows 98 system. Windows 98 works best using gtk.org's GTK+ version 2.4. Version 2.6 produces slow executables and version 2.8 seems to be broken for Windows 98.

Install MinGW

Download the MinGW installer from http://www.mingw.org/download.shtml (MinGW-3.1.0-1.exe). Apparently, version 4 may be broken, and version 5 will install once but will not re-install. Version 3 works fine, though.

Run MinGW-3.1.0-1.exe and install MinGW to c:/devel/mingw.

Install GTK+

Download the GTK+ binary package zip files from Tor Lillqvist's page at http://www.gimp.org/~tml/gimp/win32/. Use the older stable versions (2.4). The latest versions (2.6 and 2.8) are at ftp://ftp.gtk.org/pub/gtk/, but these do not work well in Windows 98.

Download and unzip these zip files to c:\devel\mingw. They will populate the bin, etc, lib, ... folders.

atk
atk-dev
gettext
gettext-dev
glib
glib-dev
gtk+
gtk+-dev
libiconv
pango
pango-dev
pkg-config
zlib123-dll

If you want support for freetype, jpeg, png and/or tiff, also download and unzip the -bin, -dep and -lib files from http://gnuwin32.sourceforge.net/packages/freetype.htm, http://gnuwin32.sourceforge.net/packages/jpeg.htm, http://gnuwin32.sourceforge.net/packages/libpng.htm and/or http://gnuwin32.sourceforge.net/packages/tiff.htm.

Install Msys and the developers' toolkit

Download MSYS-1.0.9.exe and msysDTK-1.0.0.exe from www.mingw.org/download.shtml. Run MSYS-1.0.9.exe. During installation, link to mingw when asked (c:\devel\mingw). Run msysDTK-1.0.0.exe to install the developers' toolkit.

Installing and using Glade for Windows

Installation

Download gtk-win32-devel-2.6.10-rc1.exe from http://gladewin32.sourceforge.net/modules/wfdownloads/. Version 2.8 does not work in Windows 98 - possibly a bug. Run gtk-win32-devel-2.6.10-rc1.exe and install Glade only. It is also required to install the GTK+ runtime, but you do not have to (and should not) link to it.

During installation tick only the boxes for

GTK+ runtime (required)
Glade

Do not register environment variables as this will break your previous configuration for minGW.

Configuration

If environment space a problem, add this to c:\config.sys

shell=C:\command.com /e:4096 /p

In c:\autoexec.bat, modify path

set PATH=c:\devel\mingw\bin;$PATH$

In c:\devel\msys\1.0\msys.bat add this line somewhere before the first command:

set PKG_CONFIG_PATH=/c/devel/mingw/lib/pkgconfig

This saves you from having to set the PKG_CONFIG_PATH environment variable from the Msys shell using the command

$ export PKG_CONFIG_PATH=/c/devel/mingw/lib/pkgconfig

The PKG_CONFIG_PATH environment variable must be set so that `pkg-config ...` can be used by gcc during compilation.

Compiling a Glade project

Run Glade and create a project called gladetest in

c:\devel\msys\1.0\home\<user>\Projects

All the files will be saved in

c:\devel\msys\1.0\home\<user>\Projects\gladetest

You can access the files from the Msys shell home directory at

Projects/gladetest

Alternatively, you can copy the files from a Glade project created in Linux to this location.

You can compile the project directly using gcc as follows.

$ cd Projects/gladetest/src

$ gcc \
  *.c \
  -o gladetest.exe \
  -mms-bitfields \
  -mwindows \
  -DPACKAGE_DATA_DIR="\"/c/devel/mingw/share\"" \
  -DPACKAGE="\"gladetest\"" \
  -DPACKAGE_LOCALE_DIR=\"\" \
  -DPACKAGE_PREFIX=\"\" \
  `pkg-config --cflags --libs gtk+-2.0`

The -mwindows switch prevents a command shell window appearing along with the main application window. If you know what to put in the -DPACKAGE* switches instead of empty strings, please add that information to this page. The pkg-config command will only return its information to gcc if you call it using backticks (`), not apostrophes/single quotes (').

Getting a working autogen/autoconf/automake system setup

The versions of the "autotools" that come prepackaged with MinGW don't seem to work with Glade generated scripts. In order to get a working setup I followed the instructions in this gem, found in the MinGW MSYS discussion forums on SourceForge ( http://sourceforge.net/forum/message.php?msg_id=2777355 ):

Basically, (cleaing up my earlier messy post from quick elation), You need to the MSYS Developer Kit and install that in the MSYS\1.0 dir. Then build Autoconf 2.59, then Automake 1.92, and then Libtool 1.5.10 yourself, in that order. Those precompiled packages on the MingW page somehow Break ./autoconf.sh from working when just extracting them onto the MSYS install.

Running a Glade application

After compiling your Glade project you should find a .exe file in the src directory. You can run it from the source directory either from the Msys shell or directly from Windows. Windows 98 will complain about finding certain .dll files, even though they are on the path. Copy these GTK+ version 2.4 files into the src directory, and the application should then run:

c:\Devel\MinGW\bin\iconv.dll
c:\Devel\MinGW\bin\libglib-2.0-0.dll
c:\Devel\MinGW\bin\libgobject-2.2-0.dll

GTK+ version 2.6 also seems to need

c:\Devel\MinGW\bin\libgmodule-2.0-0.dll

You can also set up a runtime environment from which to run the application. Unzip the GTK+ runtime files to a new directory:

atk
gettext
glib
gtk+
libiconv
pango
zlib123-dll

Copy the .exe application and the 3 (or 4) necessary .dll files to the bin subdirectory. You can run the application directly from the bin directory, even if you copy the parent directory to a different Windows 98 installation.

References and links

Much of the information in this article is based on the Win32 gtk+ Howto at http://www.ibiblio.org/apollo/WinGtkHowto.html.

How to use Glade with MinGW in other versions of Windows

Please add any information here.