Building wxWidgets 3.x

Compile wxWidgets 3.1 with TDM-GCC/mingw32

Download and install

Download wxWidgets from here (mirror) and TDM-GCC from here (mirror).

For installing TDM-GCC just follow the on-screen instructions and choose the version TDM-GCC Current: 5.1.0-tdm-1 when installing. TDM-GCC should be added to your PATH variable automatically, if not, add it.

When installing/extracting wxWidgets it doesn't matter where/what directory you choose, you can move your wxWidgets installation later.

Compile wxWidgets

Open an cmd-window and navigate to build/msw inside your wxWidgets installation directory.

To avoid problems, set your PATH to your compilers bin folder with the command:

set PATH=your/path

Note: if you skip this step and you have any other compilers or systems like MSYS in your PATH, it may cause problems when compiling.

Now we are ready to compile. You may want to compile both debug and release versions. Debug version is handy when developing your apps. To see all compiling arguments/options refer to this link or check out the file at build/msw/config.gcc inside your wxWidgets folder. Also have a look at the Troubleshooting section below if you run into problems.

To compile, we want to first clean the source code with the command:

mingw32-make -j4 -f makefile.gcc SHARED=0 BUILD=release CXXFLAGS="-fno-keep-inline-dllexport -std=gnu++11 -O2 -Wno-deprecated-declarations" clean

Then we can compile wxWidgets, with the same command as above but without the "clean" part at the end:
Note: you might want to change -j4 to whatever number of cores you have to speed up the compiling, e.g -j8 for 8 cores CPU.

mingw32-make -j4 -f makefile.gcc SHARED=0 BUILD=release CXXFLAGS="-fno-keep-inline-dllexport -std=gnu++11 -O2 -Wno-deprecated-declarations"

This may take a while, from 2-50 minutes depending on your system.
Then repeat the clean/compile steps above, but with BUILD argument set to debug for building the debug version of wxWidgets.

Thats it, wxWidgets is now ready for use! You may now move your wxWidgets folder to a place you want it.


If you see errors like this during the clean step:

It is because something in your PATH is interfering with the cleaning process, probably MSYS. Remove it from your PATH reopen the cmd window and try again.

If you see errors like this during the compile step:

Try again, it sometimes took me up to 3 tries before it worked.