You are not logged in.

#1 2013-03-27 02:31:28

dagdaben
Member
Registered: 2013-03-27
Posts: 2

[SOLVED] g_hook_insert_sorted Glib error in GTK tutorial

Hey,

I'm currently trying to learn how to implement GTK into one of the programs I'm making and thought what better place to start than here: https://developer.gnome.org/gtk-tutorial/2.24/c39.html

gtk_test.c

#include <gtk/gtk.h>

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    
    gtk_init (&argc, &argv);
    
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_show  (window);
    
    gtk_main ();
    
    return 0;
}

The code compiles fine with:

gcc -lgtk -lgdk -lX11 `pkg-config --cflags --libs gtk+-2.0` -o gtk_test gtk_test.c

I try to run ./gtk_test and:

[ben@arch code]$ ./gtk_test

(gtk_test:11501): GLib-CRITICAL **: g_hook_insert_sorted: assertion `hook->func != NULL' failed

(gtk_test:11501): Gtk-WARNING **: Failed to load module "libcanberra-gtk-module.so": libcanberra-gtk-module.so: cannot open shared object file: No such file or directory

(gtk_test:11501): GLib-CRITICAL **: g_datalist_id_dup_data: assertion `key_id != 0' failed

Any help would be much appreciated. This is my first post so sorry if I haven't included anything that might help!

Last edited by dagdaben (2013-03-28 17:55:02)

Offline

#2 2013-03-28 17:51:00

dagdaben
Member
Registered: 2013-03-27
Posts: 2

Re: [SOLVED] g_hook_insert_sorted Glib error in GTK tutorial

herp derp, no need to include -lgtk, -lgdk, etc as pkg-config deals with it.

 [ben@arch code]$ pkg-config --libs gtk+-3.0
-lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 
 gcc `pkg-config --cflags --libs gtk+-3.0` -o gtk_test gtk_test.c 

Last edited by dagdaben (2013-03-28 17:52:30)

Offline

Board footer

Powered by FluxBB