Re: gtk2 Segmentation faults



Ronald Bultje <rbultje ronald bitfreak net> wrote:
> On Sun, 2002-03-17 at 23:00, Kristian Peters wrote:
> >  int main( int   argc,
> >            char *argv[] )
> >  {
> >      printf("1\n");
> >      GtkWidget *window;
> >      printf("2\n");
> > [...]
> > 
> > reveals:
> 
> I wonder why this actually compiled, you're using a declaration of a
> variable after a function call, which is not allowed in C...

Yes ok. That was copy'n'paste. Sorry for confusion. My fault. It's too late already. The program crashes between that two printf statements:

#include <stdio.h>
#include <gtk/gtk.h>

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

$ ./test 
1
Segmentation fault

I tried the binary rpms from gtk.org and with them the program crashes _after_

GtkWidget *window;

I'll try other declarations tomorrow. If it's late I could be really a chaos guy. ;-)

*Kristian

  :... [snd.science] ...:
 ::
 :: http://www.korseby.net
 :: http://gsmp.sf.net
  :..........................:



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