Installing and configuring under Ubuntu

From WxWiki

Jump to: navigation, search

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.

Contents

[edit] 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.

[edit] 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:

libwxgtk2.8-dev libwxgtk2.8-dbg

If you don't have a C or C++ compiler yet, you can install one by installing this package:

build-essential

[edit] Packages for wxPython 2.8

Install these packages and you will get everything you need to make wxWidgets applications with Python:

python-wxtools python-wxgtk2.8-dbg

If you will use XRC you will also need the python-xml package.

Do you need a good IDE for writing your wxPython apps? Install the idle package.

[edit] Using a 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 sudo 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)

deb http://apt.wxwidgets.org/ gutsy-wx main
deb-src http://apt.wxwidgets.org/ gutsy-wx main 

3. 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 libwxgtk2.6-dev wx2.8-headers

5. Now that all of that stuff is installed we have to get the directory structure correct. Still in the terminal

cd /usr/include

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.

6. Now comes the important bit. 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

[edit] Compiling note

When you compile your files to include the libraries etc. Add this to the end of your gcc command

`wx-config --cxxflags` `wx-config --libs`
Personal tools