wx-config windows port

wx-config-win is a tiny implementation of wx-config for Windows compilers.

Home | Issue tracker | Source | Download

What is wx-config?

wx-config is a helper tool used when compiling applications that makes use of the wxWidgets library.
It helps you insert the correct compiler options on the command line so an application can use
g++ -o test.exe test.cpp `wx-config --libs --cflags` for instance, rather than hard-coding
values on where to find wxWidgets and it's configurations (monolithic, debug, unicode, wxuniversal, etc).

Note that backticks is a property of the shell or the build system used.
Fortunately the Code::Blocks IDE supports backticks natively on windows.
For other Windows IDEs and build systems there are workarounds, commonly using response files.


The purpose of this wx-config port is to make everything more easy in these situations:

  • When compiling wxWidgets apps between Linux and Windows (the Code::Blocks projects are almost the same between Linux and Windows, so it's less maintenance).
  • When compiling wxWidgets apps in Windows but wanting to use any configuration and any compiler supported (in Code::Blocks only MinGW MONOLITHIC builds are supported by the wizard). This port gives support for MinGW, VC, and DMars, and for every possible wxWidgets configuration (NON-MONOLITHIC, DEBUG, UNICODE, UNIVERSAL, etc).
  • Linux developers can feel at home.
  • Hopefully everything will be easier in any case :)


Download the wx-config port from here: http://wx-config-win.googlecode.com/svn/binary/wx-config.exe


The usage is as following:

  • Copy wx-config.exe to anywhere in your path.
  • Set an environmental variable, called WXWIN. You can do so in two ways: 

    As a System setting

    Go to Start menu->Control Panel->System->Advanced->Environment Variables and there click New, setting Variable name to WXWIN and Variable value to where you have wxWidgets installed (ie. C:\wxWidgets2.6.3).

    As a Code::Blocks setting

    Launch Code::Blocks. Go to Settings->Environment->Environment variables and there click Add, setting Key to WXWIN and Value to where you have wxWidgets installed (ie. C:\wxWidgets2.6.3).

  • That's all.


  • If you have only one configuration, it will be autodetected (including the compiler used).
  • If you have more than one, you can use wx-config --wxcfg=gcc_dll\mswu for example, or set an env. var. like WXCFG=gcc_dll\mswu for choosing the configuration you want. 

Sample Code::Blocks project

This is a wxWidgets sample project that compiles as-is, on GCC on Linux and Windows (if you're using other compiler you'll only have to select it from within C::B, without any further touching the project):

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <FileVersion major="1" minor="5" />
        <Option title="wxSample" />
        <Option compiler="gcc" />
            <Target title="default">
                <Option output="wxSample.exe" extension_auto="1" />
                <Option type="0" />
                <Option compiler="gcc" />
            <Add option="`wx-config --cflags`" />
            <Add option="`wx-config --libs`" />
        <Unit filename="main.cpp">
            <Option compilerVar="CPP" />
            <Option target="default" />

Command line options

Usage: wx-config [options]


Path of the wxWidgets installation (ie. C:\wxWidgets2.6.3).

--wxcfg[=DIR] (not present in original wx-config)

Relative path of the build.cfg file (ie. gcc_dll\mswud).


Outputs all pre-processor and compiler flags.


Same as --cflags but for C++.


Outputs all resource compiler flags. [UNTESTED]


Outputs all linker flags.


Uses a debug configuration if found.


Uses an unicode configuration if found.


Uses a static configuration if found.


Uses an universal configuration if found.

--compiler[=gcc,dmc,vc] (not present in original wx-config)

Selects the compiler.


Outputs the wxWidgets release number.


Outputs the name of the C compiler.


Outputs the name of the C++ compiler.


Outputs the linker command.

-v (not present in original wx-config)

Outputs the revision of wx-config.