]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/compiling.sgml
Correct sonames appearing in the docs
[~andy/gtk] / docs / reference / gtk / compiling.sgml
1 <?xml version="1.0"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3                "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
4 ]>
5 <refentry id="gtk-compiling">
6 <refmeta>
7 <refentrytitle>Compiling GTK+ Applications</refentrytitle>
8 <manvolnum>3</manvolnum>
9 <refmiscinfo>GTK Library</refmiscinfo>
10 </refmeta>
11
12 <refnamediv>
13 <refname>Compiling GTK+ Applications</refname>
14 <refpurpose>
15 How to compile your GTK+ application
16 </refpurpose>
17 </refnamediv>
18
19 <refsect1>
20 <title>Compiling GTK+ Applications on UNIX</title>
21
22 <para>
23 To compile a GTK+ application, you need to tell the compiler where to
24 find the GTK+ header files and libraries. This is done with the
25 <literal>pkg-config</literal> utility.
26 </para>
27 <para>
28 The following interactive shell session demonstrates how
29 <literal>pkg-config</literal> is used (the actual output on
30 your system may be different):
31 <programlisting>
32 $ pkg-config --cflags gtk+-3.0
33  -pthread -I/usr/include/gtk-3.0 -I/usr/lib64/gtk-3.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
34 $ pkg-config --libs gtk+-3.0
35  -pthread -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
36 </programlisting>
37 </para>
38 <para>
39 The simplest way to compile a program is to use the "backticks"
40 feature of the shell. If you enclose a command in backticks
41 (<emphasis>not single quotes</emphasis>), then its output will be
42 substituted into the command line before execution. So to compile
43 a GTK+ Hello, World, you would type the following:
44 <programlisting>
45 $ cc `pkg-config --cflags --libs gtk+-3.0` hello.c -o hello
46 </programlisting>
47 </para>
48
49 <para>
50 If you want to make sure that your program doesn't use any deprecated
51 functions, you can define the preprocessor symbol GTK_DISABLE_DEPRECATED
52 by using the command line option <literal>-DGTK_DISABLE_DEPRECATED=1</literal>.
53 There are similar symbols GDK_DISABLE_DEPRECATED,
54 GDK_PIXBUF_DISABLE_DEPRECATED and G_DISABLE_DEPRECATED for GDK, GdkPixbuf and
55 GLib.
56 </para>
57
58 <para>
59 If you want to make sure that your program doesn't use any functions which
60 may be problematic in a multihead setting, you can define the preprocessor
61 symbol GDK_MULTIHEAD_SAFE by using the command line option
62 <literal>-DGTK_MULTIHEAD_SAFE=1</literal>.
63 </para>
64
65 <para>
66 Similarly, if you want to make sure that your program doesn't use any
67 functions which may be problematic in a multidevice setting, you can
68 define the preprocessor symbol GDK_MULTIDEVICE_SAFE by using the command
69 line option <literal>-DGTK_MULTIDEVICE_SAFE=1</literal>.
70 </para>
71
72 </refsect1>
73 </refentry>