Building wxWidgets with MinGW

Pages: 1234
alright, I did it and here is what it spit out:

$ cd "C:\Program Files\CodeBlocks\wxWidgets-2.8.12\build\msw"

username@username-PC /c/Program Files/CodeBlocks/wxWidgets-2.8.12/build/msw
$ make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1
if not exist gcc_mswudll mkdir gcc_mswudll
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

c:\Program Files\CodeBlocks\wxWidgets-2.8.12\build\msw>

It took not even a second. And then it switched to command prompt. I will test to see if it built by compiling a test program.

it didn't work..... :(
Last edited on
Delete all the files in
c:\Program Files\CodeBlocks\wxWidgets-2.8.12\build\msw\gcc_mswudll\
and run it again.
....... There is no folder with that name...
I had this problem too and it took months to fix as I couldn't get a straight answer. This is what I did in the end.

I would also set up MingW or if it's in CodeBlocks set up code::blocks in a simple directory path like C:\MinGW or C:\CodeBlocks\MinGW .

1 - set the 'Path' environmental varialbe to the bin folder in your mingw bin directory. (There are plenty of instructions on the web for this)
You will already see the 'Path' variable set to a few other directory paths. You simple add a ; to the end of them and paste in the MinGW bin folder path. eg in mine it was C:\CodeBlocks\MinGW\bin ... Thats it.

2 - Open the command prompt, change the directory to the wxWidgets directory. Put the wxWidgets directory somewhere like C:\wxWidgets, I believe if the path has spaces between the directory names then it can cause an issue. Not sure why so jut keep it simple.

Changing the directory is simple. In my case it was
cd C:\wxWidgets Thats it.

3 - enter the below two lines seperately. First build the debug version and then the release version. I've set Shared = 0 below as I don't want to use a dll. I gather you want to statically link your projects. The below works

mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=release

mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=debug

******Thats it, now wxWidgets has been build you can start on creating a new project******

The steps below explain how to not get an error when doing that. The settings in Code::Blocks which is what I'm using correspond to the
Shared, Unicode, Monolithic settings above.

When you go to create a new project for the first time (if you are using Code::Blocks, the above settings will need to correspond to the settings in your project or you will keep getting errors.

eg.. in the WXWidgets library settings you tick
wxWidgets is built as monolithic (because you have set Monolithic = 1 above)

Enable unicode
(because you have set Unicode = 1 above)

Create and use a precompiled header (tick this)

I also ticked, 'Configure advanced options' and it works fine.

All other options should be unticked. That is 'Use wxWidgets DLL' because you set Shared = 0 above.

I realize this is not very technically worded but I'm trying to give you what I have done so you don't have to go through the months of hell to get this working that I did.
Hope this helps.

Last edited on

Thank you so much! I will try that and post what happens.
Just one correction on my above.. My apologies, made a mistake.

When changing the directory in the command line the correct setting is

C:\wxWidgets-2.8.12\build // obviously it's the build directory in the wxWidgets directory.

Username@USERNAME-PC /c/CodeBlocks/wxWidgets-2.8.12/build
$ mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=debug
sh: mingw32-make: command not found

Copied and pasted from the MSYS command line... did you want me to use make?

This is what I get when I used make:

USERNAME@Username-PC /c/CodeBlocks/wxWidgets-2.8.12/build
$ make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=debug
make: makefile.gcc: No such file or directory
make: *** No rule to make target `makefile.gcc'. Stop.

In Build/msw, mingw32-make acts as though I didn't type a word in. Using make returns the following, and switches into command prompt:

Username@USERNAME-PC /c/CodeBlocks/wxWidgets-2.8.12/build/msw
$ make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=debug
if not exist gcc_mswud mkdir gcc_mswud
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

Note that these actions are taken immediately after the command is entered.

It also fails to create the directory gcc_mswud... this is starting to become such an insufferable task.

Last edited on
wxwidgets does not need MSYS to build/link correctly in windows ! If you insist to use MSYS, then read about building wxwidgets in *nix environments using ./configure options (that's right !).

I always use latest port of GCC on windows, but this is NOT required:

Download and install wxwidgets installer from

Then just run mingw32-make -f makefile.gcc from %WXWIN%\build\msw directory. You can edit config.gcc before doing this step. Make sure that bin directory of your directory is in %PATH%. (TDM installation setup this for you automatically)
No, not MSYS in this case. I understand why you might thing that considering 99.9% of people on any forum in the world will give you a command prompt to input and it will be for MSYS but nobody will even mention MSYS.

In this case it's just plain old Windows CMD promt.

Enter the full Debug and Release commands I've given you above.
Last edited on
Ah, that changes things. No one told me (after telling me to use MSYS) that I was supposed to use command prompt. I will start now.

C:\CodeBlocks\wxWidgets-2.8.12\build\msw>mingw32-make -f makefile.gcc SHARED=0 U
'mingw32-make' is not recognized as an internal or external command,
operable program or batch file.

Command prompt. It did the same in widgets\build.

EDIT1: I just noticed somthing: mingw32-make in my msw directory appears empty. I don't know why, but it is. 0kb. Could this have somthing to do with my problems? If so, where can i download it seperately?
Last edited on
In Build/msw, mingw32-make acts as though I didn't type a word in. Using make returns the following, and switches into command prompt:

Username@USERNAME-PC /c/CodeBlocks/wxWidgets-2.8.12/build/msw
$ make -f makefile.gcc SHARED=0 UNICODE=1 MONOLITHIC=1 BUILD=debug
if not exist gcc_mswud mkdir gcc_mswud
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

Can you check if that folder does exist? If it does delete everything in it and run the command again.

IIRC you using nuwen mingw ( )? If so, I dont think it has mingw-make (at least my copy doesn't) but does include make. At this point, if the previous suggestion didn't work, I'd suggest installing a fresh copy of both mingw (nuwen is using gcc-4.7.2 now) and wxWidgets.
Alright, I'm just going to re-install everything. Do I need MSYS yes or no?

I will be building 2 libraries: BOOST and wxWidgets.
Last edited on
I dont think you need to build boost with the nuwen mingw but I'm not certain. Try without msys first, I was able to build without it.
You don't need MSYS.. I didn't even know what MSYS was when I build wxWidgets with Mingw.
MSYS is only needed if you want to build libraries that does not really have a windows port and can only be build by a ./configure script (neither wxwidgets or boost require MSYS).
Should I put Boost in C:\Program Files?

Alright, so I started following some instructions:

And that's for version 1.47.0, but I have version 1.51.0. Are thos instructions good? I have already foung no folder named boost-jam-3.1.18-1-ntx86, so I want to make sure that these instructions can be used on the latest version.
Last edited on
So, heres what I get when I trey to build wxWidgets:

C:\wxWidgets-2.8.12\build\msw>mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 MO
if not exist gcc_mswud mkdir gcc_mswud
gcc -c -o gcc_mswud\wxregex_regcomp.o -g -O0 -mthreads  -DHAVE_W32API_H -I..\..\
include -I..\..\lib\gcc_lib\mswud -D__WXMSW__  -D_UNICODE   -MTgcc_mswud\wxregex
_regcomp.o -MFgcc_mswud\wxregex_regcomp.o.d -MD -MP ../../src/regex/regcomp.c
gcc: CreateProcess: No such file or directory
mingw32-make: *** [gcc_mswud\wxregex_regcomp.o] Error 1

Any suggestions? I added that environment variable end everything... I completely re-installed Code::Blocks/MinGW and wxWidgets before doing this!
Can you check the makefile.gcc in the msw folder. Is the first letter in uppper case such as Makefile.gcc as opposed to makefile.gcc . That will cause an error if the case is wrong.

Try that.
Nothing wrong with makefile.gcc.....

this is what my environmental variables look like:

C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Nmap;C:\CodeBlocks\MinGW\bin;


wxWidgets: C:\wxWidgets-2.8.12
CodeBlocks: C:\CodeBlocks
MinGW: C:\CodeBlocks\MinGW

Edit1: I just noticed somthing: There is a slash after each directory in environmental variables i didnt notice before, and didnt add to the end of mingw's. I will add that and try.

EDIT2: never mind.... I still get the same error.
Last edited on
ok. I'm so fucking sick of these dumb instructions on how to "build" boost:

Ensure that Boost Jam is in the PATH environment variable (where <path> is the path you unpacked Boost Jam to):

set PATH=<path>\boost-jam-3.1.18-1-ntx86;%PATH%

Sorry to burst your bubble, but not even in version 1.47 is there any boost-jam-3.1.18-1-ntx86. I did a file search and you know what I found? NOTHING! Could someone please give me correct instructions (or link, or anything, just as long AS IT WORKS) before i punch a hole through my computer's screen. This is driving me crazy, and it's supposed to be the instructions to set this up with codeblocks. Obviously not. I downgraded just to follow the instructions and it still doesnt work. I even used my search program (searches every file and directory even hidden/locked, etc....) and didnt find it.

Please if you can help me I would be so greatful!
Last edited on
Pages: 1234