C-Programmierung

Qt Installation

Praxisbeispiel mit Qt | | Compilation eines Qt Projekts mit CMake

Installation of Qt4

On Linux, it is mostly sufficient to install a recent Qt binary package using the Ubuntu software manager, for example. The list of available Ubuntu packages is available online.

On the command line installation is even simpler:

Ubuntu/Debian:

sudo apt-get install libqt4-dev

OpenSuse:

sudo zypper install libqt4-devel

You can search for all available packages of Qt with

Ubuntu/Debian: apt-cache search qt
OpenSuse: zypper search qt

On MacOS X and Windows, it is recommended to build and install the latest Qt 5 from source!

Installation of Qt5 from Source

On a Mac we need to install Qt from source as follows. This can take a while.

Grab the most recent Qt source tar ball for MacOS X from:

http://download.qt.io/archive/qt

For example, grab the Qt 5.7.1 source tar ball for MacOS X 10.10 from:

http://download.qt.io/archive/qt/5.7/5.7.1/single/qt-everywhere-opensource-src-5.7.1.tar.gz

Create a working directory for your Qt software projects (e.g. ~/qt-projects) and put the Qt source tar ball (.tar.gz) there.

Then use the Terminal (unix shell) to navigate (change directory) to the working directory:

cd ~/qt-projects

Extract the Qt source tarball:

tar zxvf qt-everywhere-opensource-src-5.7.1.tar.gz

Navigate into the extracted source

cd qt-everywhere-opensource-src-5.7.1

Then type on the unix console:

./configure -opensource -confirm-license -nomake examples -nomake tests && make -j2

After the build process has finished (go get yourself a cup of coffee) you need to install the compiled binaries and libraries on the Unix system via the following unix command:

sudo make install

You will be asked to enter your root password for installation of Qt. The binaries will usually be installed in /usr/local/Trolltech/… or /usr/local/Qt… depending on your system configuration.

Please write down your particular installation directory, since you will need it later.

Now we are ready to get our hands on the first Qt example.

Praxisbeispiel mit Qt | | Compilation eines Qt Projekts mit CMake

Options: