Main.InstallingWxWidgetsOnWindows


wxWidgets is a powerful and useful cross-platform Graphical User Interface Library. This tutorial steps through installing wxWidgets for application development purposes:

Project website: http://wxwidgets.org/

Here are the published file hashes for v2.9.4:

  • 0adcc19fd4eca50eba3abb0b46eb83c055146bdb wxWidgets-2.9.4.7z
  • 5a34ddf19d37c741f74652ee847df9568a8b81e1 wxWidgets-2.9.4.tar.bz2
  • 4697b6e45a20c9e05d888458d658f89ada8dd5c9 wxWidgets-2.9.4.zip
  • 37fc96b3194ad47a574ba8013264104cdf4c942c wxWidgets-docs-html-2.9.4.tar.bz2
  • bbf4bdf1c0746fe0b634ed55e2657d327db12033 wxWidgets-docs-html-2.9.4.zip

This document deals with creating a single-file "monolothic" installation of wxWidgets which means that you can distribute your dependent application with just a single wxWidgets dll file. To completely succeed in this goal you need to disable threads in the wxWidgets configure step, in order to remove the additional need for mingwm10.dll, a small file providing parts of the mingw runtime.

If you need thread support, you will have to include this small file in addition to the wxWidgets dll unless you want to get your hands really dirty.

The compiling is done using MSYS and MinGW, which provide a minimal unix-like environment on top of windows. This enables the use of wxWidgets' configure scripts and autotools build functionality. This is why the commands you see below look like unix commands.

Useful links

Passing compiler flags to the wxwidgets configure script on MinGW:

Some more information about linking issues:

Step by step instructions

Extract and compile wxWidgets library

  1. Download the latest wxWidgets distribution: http://wxwidgets.org/downloads/
  2. I am placing the downloads in C:\Tools\Middleware\ and extracting and compiling from there, as
  3. tar -xvf wxWidgets-2.9.4.tar.bz2
  4. cd wxWidgets-2.9.4
  5. ./configure --enable-monolithic --disable-threads --disable-no_exceptions LDFLAGS="-static-libgcc -static-libstdc++"
    1. The LDFLAGS given after the configure command are to make sure that the C++ compiler runtime libraries are linked statically into the final wxWidgets DLL, so that you don't need to distribute a bunch of extra runtime DLLs with your application. Doing this breaks exception handling, so we disable wxWidgets exception handling (which is reasonable in this case since wxWidgets was not originally designed around exceptions as an error handling mechanism).
  6. make
  7. make install

Compile minimal sample to test things are working ok

  1. cd samples/minimal
  2. make
  3. ./minimal.exe

You may discover you need to place the wxWidgets dll into the folder containing the minimal.exe file in order for the executable to find the DLL it needs to run.

Helpful links