The CodeBlocks.cbp project uses wx2.8.12.
If you want to compile C::B with wx3.1.x you must use CodeBlocks_31.cbp or CodeBlocks_31_64.cbp (or the matching workspaces if you want the plugins).
The simplest option is compiling C::B with the same wxWidgets version you will use for your programs.
Beware if using wx3.1.2, you will get crashes with Code Completion if you don't patch wxWidgets.