0% found this document useful (0 votes)
54 views5 pages

Install and Configure Wxwidgets On Macos X and Ubuntu

This document provides instructions for installing and configuring wxWidgets, a C++ library for building GUI applications, on MacOS X and Ubuntu. It describes downloading wxWidgets, building and installing it for each platform, and running sample programs. On MacOS X, the user builds wxWidgets with commands like "make" and "make install" in a terminal. On Ubuntu, the user first installs GTK dependencies before building and installing wxWidgets similarly with commands like "configure", "make", and "make install".

Uploaded by

Adi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views5 pages

Install and Configure Wxwidgets On Macos X and Ubuntu

This document provides instructions for installing and configuring wxWidgets, a C++ library for building GUI applications, on MacOS X and Ubuntu. It describes downloading wxWidgets, building and installing it for each platform, and running sample programs. On MacOS X, the user builds wxWidgets with commands like "make" and "make install" in a terminal. On Ubuntu, the user first installs GTK dependencies before building and installing wxWidgets similarly with commands like "configure", "make", and "make install".

Uploaded by

Adi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Install and Configure wxWidgets

on MacOS X and Ubuntu


Ronald Mak
Department of Computer Engineering
Department of Computer Science
Department of Applied Data Science
January 12, 2019
Revised: January 8, 2020

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).

Figure 1. Sample program widgets.

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.

Build and install wxWidgets on MacOS X


In a terminal window, cd to your wxWidgets-version directory. Then enter the following commands:

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”.

Build and install wxWidgets on Ubuntu


The GTK development package
Build wxWidgets on top of the GIMP Toolkit (GTK) libraries which are already installed in Ubuntu. GTK is
a multi-platform toolkit for creating graphical user interfaces. See https://www.gtk.org/

First download and install the GTK development package. In the Ubuntu terminal, enter the following
command on the command line:

sudo apt install libgtk-3-dev

2
R. Mak, Install and Configure wxWidgets on MacOS X and Ubuntu

Build and install wxWidgets


Enter your wxWidgets directory, create a new subdirectory gtk-build, and cd to it:

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

Build the sample and demo programs


Build all the sample programs (takes a long time):

cd samples
make

Build all the demo programs:

cd ../demos
make

Run the sample and demo programs


You should now be able to run the minimal sample program (Figure 3):

cd ../samples/minimal
./minimal

Figure 3. Sample program minimal on MacOS X and on Ubuntu.

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

Figure 4. Sample program widgets on MacOS X and on Ubuntu.

4
R. Mak, Install and Configure wxWidgets on MacOS X and Ubuntu

Demo program forty (Figure 5):


cd ../../demos/forty
./forty

Figure 5. Demo program forty on MacOS X and on Ubuntu.

You might also like