PB’s Guide to Starting with wxWidgets on Microsoft Windows with MinGW and Code::Blocks

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Part Of The Furniture
Part Of The Furniture
Posts: 2511
Joined: Sun Jan 03, 2010 5:45 pm

PB’s Guide to Starting with wxWidgets on Microsoft Windows with MinGW and Code::Blocks

Post by PB » Thu Jun 04, 2020 7:11 pm

I am aware that there already are several recent guides to using wxWidgets with MinGW and Code::Blocks. However, I wrote most of mine almost two years ago, but did not find time to finish it. But now I did and updated it for the latest versions of wxWidgets, MinGW and Code::Blocks.

My guide hopes to assist the readers with decisions regarding which wxWidgets version and configuration to use and show how to build wxWidgets using MinGW with various parameters affecting the resulting build. It also describes in detail setting-up a wxWidgets project in popular IDE Code::Blocks. Its page count may seem off-putting to some, but there is not that much text, most of it is pictures and whitespace.

I wrote the guide in Microsoft Word, using complex formatting and it seems that converting all of it to MediaWiki or HTML format is quite difficult, so at least for the time being, it is provided only in the PDF format.

The guide is available at https://github.com/PBfordev/wxpbguide as wxPBGuide.pdf. I recommend using a decent PDF viewer instead of GitHub's built-in one, which lacks useful features such as displaying a navigable TOC or clicking on document's internal cross links.

Perhaps the guide helps someone, it should cover all necessary information, hopefully presented in a simple and understandable way.

Versions of software used in guide
wxWidgets: 3.1.4
MinGW: MSYS2 mingw-w64-i686-toolchain (GCC 10.2 at the time of writing)
Code::Blocks: 20.03

Table of Contents
1 Introduction
2 Basic wxWidgets Information
2.1 wxWidgets Versions
2.2 Shared vs Static Linking
2.3 Multilib vs Monolithic Build
2.4 Debug and Release Configuration
2.5 32-bit vs 64-bit Build
2.6 To Build or Not to Build
3 Building wxWidgets with MinGW
3.1 Choosing MinGW Distribution
3.2 Installing MSYS2
3.3 Installing MSYS2 packages for developing C++ applications
3.4 Downloading wxWidgets Sources
3.5 Adding System Environment Variable WXWIN
3.6 The Build
3.6.1 Starting Simple
3.6.2 Improving Build Commands
3.6.3 Making wxWidgets Build Faster
3.6.4 Viewing Build Results
3.6.5 Using the Minimal Sample to Test the Build
3.6.6 Cleaning the Build
3.6.7 Building wxWidgets Statically
3.6.8 More Build Options
4 Setting Up wxWidgets Project with Code::Blocks and MinGW
4.1 Installing Code::Blocks
4.2 Configuring the Debugger
4.3 Configuring the Compiler
4.4 Creating Global Variable wx
4.5 Creating a wxWidgets Project with Project Wizard
4.5.1 Selecting wxWidgets Project Template
4.5.2 Wizard Page 1: Welcome
4.5.3 Wizard Page 2: wxWidgets Version
4.5.4 Wizard Page 3: Project Title and Paths
4.5.5 Wizard Page 4: Project Author
4.5.6 Wizard Page 5: GUI Builder and Application Type
4.5.7 Wizard Page 6: wxWidgets Location
4.5.8 Wizard Page 7: Compiler and Debug/Release Configurations
4.5.9 Wizard Page 8: Various Configuration Options
4.5.10 Wizard Page 9: Advanced Options
4.5.11 Wizard Page 10: Additional Libraries
4.6 Adjusting Project Settings
4.6.1 Setting C++ Standard Used in the Project
4.6.2 Setting Preprocessor Define NDEBUG for the Release Build Target
4.6.3 Setting Other Project Options
4.7 Finally Finished!
4.8 Extra Reading: wxWidgets Code::Blocks Project Under the Hood
4.8.1 Compiler Include Folders
4.8.2 Preprocessor Defines
4.8.3 Linker Settings
4.8.4 Using Static Instead of Shared wxWidgets Build

Post Reply