Ade Malsasa Akbar contact
Senior author, Open Source enthusiast.
Saturday, January 29, 2022 at 16:20

This tutorial explains how you can install CodeBlocks with C++/wxWidgets library and GUI designer for visual software development. Fortunately, all tools are available already on Ubuntu. CodeBlocks is the IDE, cpp is the language, wxWidgets is the user interface toolkit, and wxSmith plugin is the designer. This tutorial is wished to help you in making cross platform programs rapidly with drag and drop approach aside from coding also known as a Visual Basic or Delphi alternative. Now let's go.

Subscribe to UbuntuBuzz Telegram Channel to get article updates.

 

About This Tutorial

We present you CodeBlocks + wxWidgets Framework here as a choice of software development kits on Ubuntu alongside with the other ones we have already presented namely Qt and GTK. We support and want to enable Free/Libre Open Source Software (FLOSS) development for everyone especially the beginners. This tutorial is also an expansion of our VB6 Alternatives recommendation. The real tool here is the plugin, named wxSmith (GNU GPL), that enables the users to visually code wxWidgets (a LGPL-like license) in RAD approach inside the code editor.

We use these requirements and setup for this tutorial:

  • Ubuntu 21.10 Impish Indri
  • CodeBlocks 20.03
  • wxWidgets 3.0
  • wxSmith 1.0 (part of packages codeblocks-contrib and libwxsmithlib0)
  • GCC G++ 11.2


Install C++ Compiler

First, install GNU GCC compiler for C++ language. Fire up your Terminal and invoke this command:

$ sudo apt-get install g++


Install wxWidgets

Then, install wxWidgets, the UI toolkit library necessary to code graphical user interface programs.

$ sudo apt install libwxgtk3.0-gtk3-0v5 libwxgtk3.0-gtk3-dev


Install CodeBlocks

Then, install the integrated development environment.

$ sudo apt-get install codeblocks  


Install the GUI Designer

Finally, install the plugins that gives CodeBlocks a GUI designer. This designer is called wxSmith and is a part of codeblocks-contrib package on Ubuntu.

$ sudo apt-get install codeblocks-contrib

 

Run CodeBlocks

Open activities menu and run it from there. Now, CodeBlocks is ready. 


Getting Started to the User Interface

Here's an overview of new window of CodeBlocks. 

  • Top: titlebar, menubar, and detachable toolbars.
  • Left: projects viewer, resources viewer (properties inspector).
  • Right: GUI insert/remove/preview controller (if GUI designer's active)
  • Center: code editor, GUI designer (if it's active)
  • Bottom: statusbar, logs & others (output tabs).
  • Please note that this window is fairly flexible as every part can be moved and resized and splitted either vertically/horizontally and hidden parts of buttons palette can also be scrolled.


Create a New GUI Project

To check whether your installation is correct, you should try to create a new GUI project. To create one, click menu File > New > Project > wxWidgets > follow the instructions and select 'wxWidgets 3.0' among the choices > a new empty GUI design will open. You are now ready to use CodeBlocks to create GUI programs.

 (CodeBlocks with code editor on left and form designer on right)


 Happy hacking!



This article is licensed under CC BY-SA 3.0.