Getting Started with wxWidgets

Home / Getting Started with wxWidgets

Getting Started with wxWidgets

December 9, 2015 | Article | No Comments

People who are completely new to wxWidgets would normally follow the steps illustrated below.


In this article we will set our environment for developing a wxWidget application.

Installing wxWidgets and Setting up IDE

When developing application using wxWidget, we can choose whether use helping from IDE or not. For an overview of IDEs that have been reported to work with wxWidgets, you can see the list of IDEs on wxWidgets site.

We won’t cover installation of any IDE in this section, but I would recommend you to install one.

Your main guide for compiling wxWidgets should be the installation instructions : Look in <code-base-dir>/docs/.

On Windows

<to be continued>

On Linux

Getting Started

Before getting started, make sure you have installed all necessary build tools, including g++ and autotools. You will also need gtk+ library.

It is recommended to use at least GTK+ 2.2.3, and some features are only available when using more recent version, like GTK+ 2.8.

Building and Installation

Download the wxWidget source archive from The latest development is recommended, and when writing this article, the latest version is version 2.9.4.

You will need to call configure to configure the compilation setting. It is also recommended to enable unicode support for wxWidgets.

./configure --enable-unicode

However, if you want to compile wxWidgets on a 64-bit version of Linux in such a way that the library can be linked to both statically and dynamically, then you want to add the -fPIC flag to the configure call. That is done in the following way:

./configure --enable-unicode CFLAGS="-fPIC" CXXFLAGS="-fPIC"

The options you pass to configure at this point will determine what build you get.

–enable-unicode makes a Unicode build
–with-opengl enables OpenGL support
–disable-shared builds static libs instead of shared ones
–prefix=[…] makes wxWidgets be installed in another location than default /usr/local

A list of all possible options can be seen using ./configure –help command.

If it stops saying it can’t find a package, install it (with -dev packages if any) and run configure again. When it is done without errors, you are ready to build. When the build is done, and if no error occured, you can now install it. You also need root privileges to install it.

make install

Enter your password as needed. wxWidgets will be installed in /usr/local/

On some systems it is also necesary to run sudo ldconfig at this point.

Compile an Application

The tool wx-config allows you to quickly build wxWidgets apps

g++ `wx-config --cppflags` `wx-config --libs` widgetTest.cpp

wx-config –cppflags returns flags necessary to compilation, wx-config –libs returns flags necessary to linking. This little example has a single file so both are used at the same time but in a bigger project compiling and linking will most likely be two different steps. (How to use g++ is beyond the scope of this document)

For more information, see article Wx-Config.

On Mac OS

<to be continued>


About Author

about author


A man who is obsessed to low level technology.

Leave a Reply

Your email address will not be published. Required fields are marked *

Social Share Buttons and Icons powered by Ultimatelysocial