Touchdown.
Using the above suggestions, and some additional help from sly_chandan at '
https://forums.wxwidgets.org/viewtopic.php?t=39427', I have now solved my problem.
It's important to use the same compiler for building both wxWidgets and Code Blocks.
In addition, build command 'mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1 CXXFLAGS=-fno-keep-inline-dllexport' worked for wxwidgets version 2.8.12, but did not work for wxwidgets version 3.0.4 (does not create file 'wxmsw30u_gcc_custom.dll').
For version 3.0.4, I used build command 'mingw32-make -j8 -f makefile.gcc BUILD=release SHARED=1 UNICODE=1 VENDOR=custom MONOLITHIC=1' (as per sly_chandan which creates file 'wxmsw30u_gcc_custom.dll').
Thanks to everyone for the help.