Running GTK+ Applications

Name

Running GTK+ Applications --  How to run and debug your GTK+ application

Running and debugging GTK+ Applications

Common commandline options

All GTK+ applications support a number of standard commandline options. These are removed from argv by gtk_init(). Modules may parse and remove further options.

--gtk-module module. A list of modules to load in addition to those specified in the GTK_MODULES environment variable.

--g-fatal-warnings. Make GTK+ abort on all warnings. This is useful to stop on the first warning in a debugger, if your application is printing multiple warnings. It's almost always best to start debugging with the first warning that occurs.

--gtk-debug options. A list of debug options to turn on in addition to those specified in the GTK_DEBUG environment variable. This option is only available if GTK+ has been configured with --enable-debug=yes.

--gtk-no-debug options. A list of debug options to turn off. This option is only available if GTK+ has been configured with --enable-debug=yes.

The following options are really used by GDK, not by GTK+, but we list them here for completeness nevertheless.

--class class. Sets the program class; see gdk_set_program_class().

--name name. Sets the program name.

--gdk-debug options. A list of debug options to turn on in addition to those specified in the GDK_DEBUG environment variable. This option is only available if GTK+ has been configured with --enable-debug=yes.

--gdk-no-debug options. A list of debug options to turn off. This option is only available if GTK+ has been configured with --enable-debug=yes.

--display display. The name of the X display to open instead of the one specified in the DISPLAY. This option is only available if GTK+ has been configured with --gdk-target=x11.

--sync. Makes all X requests synchronously. This is a useful option for debugging, but it will slow down the performance considerably. This option is only available if GTK+ has been configured with --gdk-target=x11.

--gxid-host host. The host to contact the gxid daemon on; overwrites the GXID_HOST environment variable. This option is only available if GTK+ has been configured with --gdk-target=x11.

--gxid-port port. The port for the connection to gxid; overwrites the GXID_PORT environment variable. This option is only available if GTK+ has been configured with --gdk-target=x11.


Environment variables

GTK+ inspects a number of environment variables in addition to standard variables like LANG, PATH, HOME or DISPLAY; mostly to determine paths to look for certain files.

GTK_EXE_PREFIX. If set, GTK+ uses $GTK_EXE_PREFIX/lib instead of the libdir configured when GTK+ was compiled.

GTK_DATA_PREFIX. If set, makes GTK+ use $GTK_DATA_PREFIX instead of the prefix configured when GTK+ was compiled.

The following environment variables are used by GdkPixbuf, GDK or Pango, not by GTK+ itself, but we list them here for completeness nevertheless.

GDK_PIXBUF_MODULEDIR. Specifies the directory to look for GdkPixbuf loader modules. By default, GdkPixbuf looks for its loaders in libdir/gtk-2.0/version/loaders.