I needed to do this for a new project. I had no experience with wxWidgets, but quite a lot with Code::Blocks. For others like me, this might be useful.
I’m running Win 7 Pro.
Downloads needed:
Code Blocks: Download page: http://www.codeblocks.org/downloads/26
Code Blocks: Release: codeblocks-20.03mingw-setup.exe
wxWidgets: Download page: https://www.wxwidgets.org/downloads/
wxWidgets: Release: Windows ZIP or Windows 7Z
Code Blocks Installation
Run the Code Blocks installer, accept defaults for everything. Add the path for the MinGW compiler to the Windows PATH environment variable.
If you installed in the default location, the path to add is: C:\Program Files\CodeBlocks\MinGW\bin
If you don't know how to add MinGW to the Windows PATH environment variable:
Windows 10: https://www.architectryan.com/2018/03/1 ... indows-10/
Windows 7: https://www.faqforge.com/windows/settin ... windows-7/
Log out and log in again.
Run Code::Blocks and go to Settings -> Global Variables. Create a new global variable named wx and define the base, include and lib fields. Entries should match the location of wxWidgets on your computer. The pic shows the location I chose.
Next setup global search directories by clicking Settings -> Compiler -> Search Directories. Make entries as shown below in the order as shown below:
There are, apparently, two library files missing from this installation:
libuxtheme.a
liboleacc.a
Libraries Download: https://github.com/jmeubank/mingw-w64/releases
Download: Release: mingw64runtime-v7-git20191109-gcc9-tdm64-1.zip
Or Download: Release: mingw64runtime-v7-git20191109-gcc9-tdm64-1.tar.xz
Unpack and navigate to here: mingw64runtime-v7-git20191109-gcc9-tdm64-1(1).zip\x86_64-w64-mingw32\lib
The libraries should be in the list. Put them here in your installation: C:\Program Files\CodeBlocks\MinGW\lib
Add to linker settings. In CB go to Settings -> Compiler -> Linker Settings -> Add. Enter the two library filenames above.
If you want to be able to debug go to Settings -> Debugger. Click on Default and enter the path to the MinGW debugger. For my installation this is C:\Program Files\CodeBlocks\MinGW\bin\gdb.exe
wxWidgets Installation
Unpack to your location. Mine is C:\wxWidgets-3.1.3\
Open a command prompt and enter: gcc -v
The last line should be gcc version 8.1.0 (x86_64_posix-she-rev0. Built by MinGW-W64 project)
Change directory (cd) to \build\msw\ inside the wxWidgets directory. Again, in my case: C:\wxWidgets-3.1.3\build\msw
Execute the following commands, in order:
mingw32-make -f makefile.gcc SHARED=0 BUILD=debug MONOLITHIC=0
mingw32-make -f makefile.gcc SHARED=0 BUILD=release MONOLITHIC=0
And yes, they do take some time.

On successful completion you can build the "minimal" sample.
Change directory to C:\wxWidgets-3.1.3\samples\minimal.
Execute the make to build the wxWidgets libraries:
mingw32-make -f makefile.gcc SHARED=0 BUILD=debug MONOLITHIC=0
The executable "minimal.exe" should be in C:\wxWidgets-3.1.3\samples\minimal\gcc_mswud.
Launch the app. It should run normally.
Open Code::Blocks and start a new project. When it asks for the project type, scroll down to the bottom and select the wxWidgets icon.
Next screen: select wxWidgets 3.1.x
Next screen: give a project name
Next screen: author, but not required
Next screen: select wxFormBuilder and Frame Based
Next screen: enter location for wxWidgets (for me C:\wxWidgets-3.1.3).
Next screen: default should have GNU GCC Complier with compiler and debugger checked. Leave.
Next screen: select Enable Unicode. Leave the rest unchecked.
Next screen: leave features unselected for this test build. Select Finish.
CB will create a project with several files that create the equivalent of minimal.exe.
Compile this in CB. In my situation, the compile took about 20 seconds, so wait for it.
Then run. If all is well the CB minimal app will pop up after a few seconds and be functional.
All of this worked for me in this order without any problems. Please let me know if I've made any errors.