Chapter 3. Using qtHaskell

Table of Contents

3.1. Building qtHaskell Applications
3.1.1. Building with qhc/qhcd
3.1.1.1. Building with qhc/qhcd on Linux
3.1.1.2. Building with qhc on Windows

3.1. Building qtHaskell Applications

qtHaskell applications can be built like any other package based Haskell programs, using either the -package qt option for --make option with ghc command. Since the Haskell executables are rather large it is usually worth applying the strip utility which reduces their size by about 50 percent.

3.1.1. Building with qhc/qhcd

The qhc script used to facilitate the automated building of the example files supplied with qtHaskell, may also prove useful for building individual qtHaskell applications.

3.1.1.1. Building with qhc/qhcd on Linux

On Linux, the command

qhc a [option...]

is equivalent to

ghc --make -package qt -fglasgow-exts -O2 -o a a.hs [option...] -i.
strip a

For GHC 6.12.x or higher with dynamic linking enabled, the command

qhcd a [option...]

is equivalent to

ghc --make -package qt -fglasgow-exts -O2 -dynamic -o a a.hs [option...] -i.
strip a

3.1.1.2. Building with qhc on Windows

On Windows, the command

qhc a [option...]

is equivalent to

ghc --make -package qt -fglasgow-exts -O2 -optl-Wl,-subsystem,windows -o a a.hs [option...] -i.
strip a.exe

The option -optl-Wl,-subsystem,windows is required on Windows to prevent the application from opening a dos box if it is not run from one. If it is used with a program which tries to write to the standard output streams it will result in a runtime error, and hence should not be used with console applications or for example when debugging gui applications.