Install and Configure Wxwidgets On Macos X and Ubuntu
Install and Configure Wxwidgets On Macos X and Ubuntu
Introduction
wxWidgets is a C++ library that allows you to develop and deploy interactive GUI-based applications
(https://www.wxwidgets.org/ on different platforms – Windows, Mac, and Linux – and therefore you
can also build your applications with little or no code change on those platforms.
In this tutorial, you will download, configure, build, and install wxWidgets on either MacOS X or Ubuntu,
a distribution of the Linux operation system.
If you are on Windows 10, you should install Ubuntu. Read the tutorials “Install Ubuntu on Windows 10
and VirtualBox” (http://www.cs.sjsu.edu/~mak/tutorials/InstallUbuntu.pdf) and “Configure Ubuntu for
Software Development” (http://www.cs.sjsu.edu/~mak/tutorials/ConfigureUbuntu.pdf).
Using wxWidgets, you can develop C++ desktop applications that display windows and interactive
controls such as buttons, menus, text boxes, etc. (Figure 1).
1
R. Mak, Install and Configure wxWidgets on MacOS X and Ubuntu
Download wxWidgets
Go to https://www.wxwidgets.org/downloads/ to download the latest stable release (currently 3.0.4).
Click on the download link Source for Linux, macOS, etc. to download the source files of the toolkit. To
build and deploy the wxWidgets library, you will have to configure, compile, link, and install it. The
download includes shell scripts that will run in a terminal to perform these operations.
Unzip the downloaded zip file in your home directory to create a folder named wxWidgets-version,
such as wxWidgets-3.0.4.
If you are going to build on MacOS X, read the next section. If you are going to build on Ubuntu, skip to
the section “Build and install wxWidgets on Ubuntu”.
For more detailed instructions for MacOS X, see docs/osx/install.txt. For Ubuntu, see
docs/gtk/install.txt.
mkdir build-cocoa-debug
cd build-cocoa-debug
Configure and build the wxWidgets libraries (make takes a long time):
../configure –-enable-debug --with-macosx-version-min=10.9
make
Enter the following commands to install the wxWidgets header files in the standard directory
/usr/local/include and the library in the standard directory /usr/local/lib:
sudo su
make install
exit
Skip to the section “Install the wxWidgets header files and library”.
First download and install the GTK development package. In the Ubuntu terminal, enter the following
command on the command line:
2
R. Mak, Install and Configure wxWidgets on MacOS X and Ubuntu
mkdir gtk-build
cd gtk-build
Configure and build the wxWidgets libraries (make takes a long time):
../configure –-with-gtk
make
Enter the following commands to install the wxWidgets header files in the standard directory
/usr/local/include and the library in the standard directory /usr/local/lib:
sudo su
make install
ldconfig
exit
cd samples
make
cd ../demos
make
cd ../samples/minimal
./minimal
3
R. Mak, Install and Configure wxWidgets on MacOS X and Ubuntu
Sample program widgets demonstrates all the interactive control (Figure 4):
cd ../widgets
./widgets
4
R. Mak, Install and Configure wxWidgets on MacOS X and Ubuntu