diff --git a/docs/reference/glib/compiling.sgml b/docs/reference/glib/compiling.sgml index b12197d6c..5ebef07ea 100644 --- a/docs/reference/glib/compiling.sgml +++ b/docs/reference/glib/compiling.sgml @@ -20,7 +20,7 @@ How to compile your GLib application Compiling GLib Applications on UNIX -To compile a GLib application, you need to tell the compiler where to +To compile a GLib application, you need to tell the compiler where to find the GLib header files and libraries. This is done with the pkg-config utility. @@ -30,36 +30,41 @@ The following interactive shell session demonstrates how your system may be different): $ pkg-config --cflags glib-2.0 - -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include + -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include $ pkg-config --libs glib-2.0 - -L/usr/lib -lm -lglib-2.0 + -L/usr/lib -lm -lglib-2.0 -If your application uses threads or GObject -features, it must be compiled and linked with the options returned by the -following pkg-config invocations: +See the pkg-config website +for more information about pkg-config. + + +If your application uses or GObject +features, it must be compiled and linked with the options returned +by the following pkg-config invocation: -$ pkg-config --cflags --libs gthread-2.0 $ pkg-config --cflags --libs gobject-2.0 -If your application uses modules, it must be compiled and linked with the options -returned by one of the following pkg-config invocations: +If your application uses modules, it must be compiled and linked +with the options returned by one of the following +pkg-config invocations: -$ pkg-config --cflags --libs gmodule-no-export-2.0 -$ pkg-config --cflags --libs gmodule-2.0 +$ pkg-config --cflags --libs gmodule-no-export-2.0 +$ pkg-config --cflags --libs gmodule-2.0 -The difference between the two is that gmodule-2.0 adds -to the linker flags, which is often not needed. +The difference between the two is that gmodule-2.0 adds + to the linker flags, +which is often not needed. The simplest way to compile a program is to use the "backticks" feature of the shell. If you enclose a command in backticks -(not single quotes), then its output will be -substituted into the command line before execution. So to compile -a GLib Hello, World, you would type the following: +(not single quotes), then its output will +be substituted into the command line before execution. So to +compile a GLib Hello, World, you would type the following: $ cc `pkg-config --cflags --libs glib-2.0` hello.c -o hello @@ -72,21 +77,25 @@ by using the command line option -DG_DISABLE_DEPRECATED=1. -The recommended way of using GLib has always been to only include the -toplevel headers glib.h, +The recommended way of using GLib has always been to only include the +toplevel headers glib.h, glib-object.h, gio.h. -Still, there are some exceptions; these headers have to be included separately: +Still, there are some exceptions; these headers have to be included +separately: gmodule.h, -glib/gi18n-lib.h or glib/gi18n.h (see +glib-unix.h, +glib/gi18n-lib.h or +glib/gi18n.h (see the Internationalization section), -glib/gprintf.h and glib/gstdio.h +glib/gprintf.h and +glib/gstdio.h (we don't want to pull in all of stdio). Starting with 2.17, GLib enforces this by generating an error -when individual headers are directly included. To help with the -transition, the enforcement is not turned on by default for GLib +when individual headers are directly included. To help with the +transition, the enforcement is not turned on by default for GLib headers (it is turned on for GObject and GIO). To turn it on, define the preprocessor symbol G_DISABLE_SINGLE_INCLUDES by using the command line option -DG_DISABLE_SINGLE_INCLUDES.