Pages

Showing posts with label GLIB. Show all posts
Showing posts with label GLIB. Show all posts

Tuesday, September 18, 2007

Segmentation fault during g_thread_init(NULL);

A possible solution for Segmentation fault during g_thread_init(NULL); is you to change
gthread to gthread-2.0 during your configuration
e.g. AC_CHECK_LIB(gthread-2.0, g_thread_init)
or to use -lgthread-2.0 instead -lgthread as parameter to the compiler.

undefined reference to `g_thread_init'

If you get this error message
"undefined reference to `g_thread_init'"
during the compilation of your code, that use GLib.

Solution 1 - Using configure.in
insert the follow code line in your configure.in
AC_CHECK_LIB(gthread-2.0, g_thread_init)

Solution 2 - Compiler command line
add the parameter
-lgthread-2.0
to the compiler.

Wednesday, August 29, 2007

GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed

GLib message error:

---

(process:4016): GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed, use IA__g_type_init() prior to this function

(process:4016): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed


A possible resolution for this error is to insert the method "g_type_init()" in your main source code, as below.


----
gint
main (gint argc, gchar *argv[])
{
FooExample *foo;

g_type_init();

foo = g_object_new(FOO_TYPE_EXAMPLE, NULL);

g_message("Great success !!\n");

return 0;
}

---
This example is to a simple GLib code, you will use gtk_init() to a GTK code.