"use g_type_init() prior to this function" in static gtk2 binary



Hi,
  I'm encountering errors when executing a statically
linked gtk2 programme at runtime.  I've already build
glib2, atk, pango and gtk2 to get static support and I
can compile the following app statically without
compilation errors.

#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
//  gdk_rgb_init();
//  g_type_init();
  GtkWidget *window;
  gtk_init (&argc, &argv);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_show (window);
  gtk_main ();
  return 0;
}

However, at runtime, I got:

(process:16147): GLib-GObject-CRITICAL **:
gtype.c:1871: initialization assertion failed, use
g_type_init() prior to this function
(process:16147): GLib-GObject-CRITICAL **:
gtype.c:1911: initialization assertion failed, use
g_type_init() prior to this function
(process:16147): GLib-GObject-CRITICAL **:
gtype.c:1871: initialization assertion failed, use
g_type_init() prior to this function
(process:16147): GLib-GObject-CRITICAL **:
gtype.c:1911: initialization assertion failed, use
g_type_init() prior to this function
(process:16147): GLib-GObject-CRITICAL **:
gtype.c:1871: initialization assertion failed, use
g_type_init() prior to this function
(process:16147): GLib-GObject-CRITICAL **: file
gobject.c: line 615 (g_object_new): assertion
`G_TYPE_IS_OBJECT (object_type)' failed
Segmentation fault

Running in gdb gives
0x08050df5 in gtk_rc_parse_engine ()

and backtrace gives only
#0  0x08050df5 in gtk_rc_parse_engine ()
#1  0x08511858 in ?? ()


I do not normally need to call g_type_init() in a gtk
application as I know, but including it at the
beginning still doesn't help.  Any hints on how I
could eliminate the errors?

Any help is greatly appreciated, thanks.

Regards,
Abe Lau



_______________________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com.hk address at http://mail.english.yahoo.com.hk



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]