wierd runtime problem

 I'm getting odd runtime errors in any GTK program I compile now, even
something like a small hello world.

 It happens when I called GTK_OBJECT()...no idea why.

 I removed the gtk .deb pacakge, and reinstalled it. I then installed
gtk-1.0.5, and the problem was still there.

 Any ideas ?

-------------- added errors and code -------------------

 The errors are:

** WARNING **: invalid cast from `GtkWindow' to `GtkWindowType'

** WARNING **: invalid cast from `GtkWindow' to `GtkWindowType'

** WARNING **: invalid cast from `GtkButton' to `GtkWindowType'

** WARNING **: invalid cast from `GtkWindow' to `GtkWindowType'

** WARNING **: invalid cast from `GtkButton' to `GtkWindowType'

 The code is:

#include <gtk/gtk.h>
void hello (GtkWidget *widget, gpointer data)
    g_print ("Hello World\n");
gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
    g_print ("delete event occured\n");
    return (TRUE);
/* another callback */
void destroy (GtkWidget *widget, gpointer data)
    gtk_main_quit ();
int main (int argc, char *argv[])
    GtkWidget *window;
    GtkWidget *button;

    gtk_init (&argc, &argv);
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                        GTK_SIGNAL_FUNC (delete_event), NULL);
    gtk_signal_connect (GTK_OBJECT (window), "destroy",
                        GTK_SIGNAL_FUNC (destroy), NULL);
    gtk_container_border_width (GTK_CONTAINER (window), 10);
    button = gtk_button_new_with_label ("Hello World");
    gtk_signal_connect (GTK_OBJECT (button), "clicked",
                        GTK_SIGNAL_FUNC (hello), NULL);
    gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
                               GTK_SIGNAL_FUNC (gtk_widget_destroy),
                               GTK_OBJECT (window));
    gtk_container_add (GTK_CONTAINER (window), button);
    gtk_widget_show (button);
    gtk_widget_show (window);
    gtk_main ();
    return 0;


 "I am Grey. I stand between the candle and the star.
    We are Grey. We stand between the darkness and the light."

John "Kate" Looney, Horizon Open Systems. Sun Microsystems distributor and 
Support centre. Hotline: [+353 1 8055700] Web http://www.hos.horizon.ie/

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