Installing and configuring under Ubuntu
In Ubuntu you can install several ways. Both methods include getting packages using one of the APT package managers. You can use Synaptic, aptitude or the
sudo apt-get install command to install these.
Using the packages that ship with Ubuntu
The packages you need to install depends on what programming language you'll use and how you will use wxWidgets.
Packages for compiling wxWidgets 2.8 applications in C/C++
If you select and install these packages the package manager will download and install everything you need:
If you don't have a C or C++ compiler yet, you can install one by installing this package:
Finding out if your system provides newer packages
Chances are that your Ubuntu version already has newer packages as listed in this wiki. To find out what packages you Ubuntu repository provides use the following command
sudo apt.cache search libwxgt*
This is the sample output on a Ubuntu 16.04. Just look at the libwxgtk?.?-dev lines.
ibwxgtk-media3.0-0v5 - wxWidgets Cross-platform C++ GUI toolkit (GTK+ media library runtime) libwxgtk-media3.0-0v5-dbg - debugging symbols for the wxGTK media library libwxgtk-media3.0-dev - wxWidgets Cross-platform C++ GUI toolkit (GTK+ media library development) libwxgtk-webview3.0-0v5 - wxWidgets Cross-platform C++ GUI toolkit (webview library runtime) libwxgtk-webview3.0-0v5-dbg - debugging symbols for the wxGTK webview library libwxgtk-webview3.0-dev - wxWidgets Cross-platform C++ GUI toolkit (webview library development) libwxgtk3.0-0v5 - wxWidgets Cross-platform C++ GUI toolkit (GTK+ runtime) libwxgtk3.0-0v5-dbg - debugging symbols for the wxGTK GUI toolkit library libwxgtk3.0-dev - wxWidgets Cross-platform C++ GUI toolkit (GTK+ development) libwxgtk2.8-0 - wxWidgets Cross-platform C++ GUI toolkit (GTK+ runtime) libwxgtk2.8-dev - wxWidgets Cross-platform C++ GUI toolkit (GTK+ development) libwxgtk2.8-dbg - wxWidgets Cross-platform C++ GUI toolkit (GTK+ debug) libwxgtk-media2.8-0 - wxWidgets Cross-platform C++ GUI toolkit (GTK+ media library runtime) libwxgtk-media2.8-dbg - wxWidgets Cross-platform C++ GUI toolkit (GTK+ media library debug) libwxgtk-media2.8-dev - wxWidgets Cross-platform C++ GUI toolkit (GTK+ media library development)
So in this example you would have the choice between version 2.8 and 3.0. If you are in doubt, use the newer version. The basic instuctions for 2.8 below should still apply to newer releases.
Packages for wxPython 2.8
Install these packages and you will get everything you need to make wxWidgets applications with Python:
If you will use XRC you will also need the
Do you need a good IDE for writing your wxPython apps? Install the
Using other packages
It turns out that the out-of-the-box install of wxWidgets doesn't set the directories up correctly. Here is a step-by-step guide to installing and configuring wxWidgets in Ubuntu!
1.Skip to step 2 if you have gcc, g++ etc installed (i.e. build-essential). In the terminal (if you don't know what the terminal is you better read a little more on linux) type
sudo apt-get install build-essential This will install all the neccessary programs needed to compile most applications.
2. Ubuntu doesn't install the latest version of wxWidgets and certain applications (like Code::Blocks) require you to have the new version so we add this to our source list. Type
gksu gedit /etc/apt/sources.list and add this to the end of the file and save. Replace gutsy with the version of ubuntu you are using. (keep the "-wx" part)
Note that as of August 2012 there are no packages for Ubuntu 11.10 (Oneiric) or 12.04 (Precise)
deb http://apt.wxwidgets.org/ natty-wx main deb-src http://apt.wxwidgets.org/ natty-wx main3. The packages are digitally signed, so you have to import the key to prevent errors. Type the following command into the terminal to do this
curl http://apt.wxwidgets.org/key.asc | sudo apt-key add -Then, update your package list to add the new packages.
sudo apt-get update
4. If you have wxWidgets (the latest version) installed go to step 3. Install the wxWidgets library and headers by typing this in the terminal
sudo apt-get install wx2.8-headers libwxgtk2.8-0 libwxgtk2.8-dev
5. Now that all of that stuff is installed we have to get the directory structure correct. Still in the terminal
This is where the include files for wxWidgets are.
ls | grep wx
You should see a folder called wx-2.8. If you don't you haven't installed the headers correctly.
Linking and Compiling
Normally when you include wxWidgets you say "wx/wx.h" however wxwidgets is in the subdirectory of wx-2.8/wx so what we are going to do is create a link to wx-2.8/wx.
sudo ln -sv wx-2.8/wx wx
thats all now your files should compile correctly
When you compile your files to include the wxWidgets libraries, add this to the end of your gcc command:
`wx-config --cxxflags` `wx-config --libs`