From: Maurizio Colucci To: Subject: Gtk Error: Screen for GtkWindow not set --- Warning: this expression should have type unit. Date: Mon, 9 Aug 2004 15:14:51 +0200 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200408091514.51254.seguso.forever at tin.it> Hello, I am trying to write an adventure game with lablgtk2 and lablgl. I have installed debian sid which seemed to have a good support for ocaml. Unfortunately I am getting warnings and runtime errors when compiling hello world. This is the program I am trying to compile (hello.ml): open GMain let window = GWindow.window ~border_width: 10 () let button = GButton.button ~label:"Hello World" ~packing: window#add () let main () = window#event#connect#delete ~callback:(fun _ -> prerr_endline "Delete event occured"; true); window#connect#destroy ~callback:Main.quit; button#connect#clicked ~callback:(fun () -> prerr_endline "Hello World"); button#connect#clicked ~callback:window#destroy; window#show (); Main.main () let _ = Printexc.print main () This is the Makefile I am using (written by me after reading the ocaml manual): all: hello.ml ocamlc -I /usr/lib/ocaml/3.08/lablgl -I /usr/lib/ocaml/3.08/lablgtk2 lablgtk.cma lablgl.cma lablgtkgl.cma hello.ml I don't understand the warnings. however, the program compiles despite the warnings, but at runtime I am getting these errors: debian:/usr/share/doc/liblablgtk2-ocaml-dev/examples# ./a.out Gtk-WARNING **: Screen for GtkWindow not set; you must always set a screen for a GtkWindow before using the window (process:949): Gdk-CRITICAL **: file gdkpango-x11.c: line 49 (gdk_pango_context_get_for_screen): assertion `GDK_IS_SCREEN (screen)' failed (process:949): Gdk-CRITICAL **: file gdkscreen-x11.c: line 250 (gdk_screen_get_default_colormap): assertion `GDK_IS_SCREEN (screen)' failed (process:949): Gdk-CRITICAL **: file gdkpango.c: line 150 (gdk_pango_context_set_colormap): assertion `context != NULL' failed ** (process:949): CRITICAL **: file pango-context.c: line 340 (pango_context_set_base_dir): assertion `context != NULL' failed ** (process:949): CRITICAL **: file pango-context.c: line 266 (pango_context_set_font_description): assertion `context != NULL' failed ** (process:949): CRITICAL **: file pango-context.c: line 301 (pango_context_set_language): assertion `context != NULL' failed ** (process:949): CRITICAL **: file pango-layout.c: line 268 (pango_layout_new): assertion `context != NULL' failed ** (process:949): CRITICAL **: file pango-layout.c: line 787 (pango_layout_set_text): assertion `layout != NULL' failed ** (process:949): CRITICAL **: file pango-layout.c: line 664 (pango_layout_set_alignment): assertion `layout != NULL' failed ** (process:949): CRITICAL **: file pango-layout.c: line 352 (pango_layout_set_width): assertion `layout != NULL' failed ** (process:949): CRITICAL **: file pango-layout.c: line 2124 (pango_layout_get_extents): assertion `layout != NULL' failed (process:949): Gdk-CRITICAL **: file gdkscreen-x11.c: line 250 (gdk_screen_get_default_colormap): assertion `GDK_IS_SCREEN (screen)' failed (process:949): Gdk-CRITICAL **: file gdkcolor.c: line 72 (gdk_colormap_get_visual): assertion `GDK_IS_COLORMAP (colormap)' failed (process:949): Gdk-CRITICAL **: file gdkscreen-x11.c: line 250 (gdk_screen_get_default_colormap): assertion `GDK_IS_SCREEN (screen)' failed (process:949): Gdk-CRITICAL **: file gdkscreen-x11.c: line 232 (gdk_screen_get_root_window): assertion `GDK_IS_SCREEN (screen)' failed (process:949): Gdk-CRITICAL **: file gdkscreen-x11.c: line 232 (gdk_screen_get_root_window): assertion `GDK_IS_SCREEN (screen)' failed (process:949): Gdk-CRITICAL **: file gdkwindow-x11.c: line 521 (gdk_window_new): assertion `GDK_IS_WINDOW (parent)' failed (process:949): Gdk-CRITICAL **: file gdkwindow.c: line 471 (gdk_window_set_user_data): assertion `window != NULL' failed Uncaught exception: Glib.Critical("Gtk", "file gtkstyle.c: line 845 (gtk_style_attach): assertion `window != NULL' failed") Fatal error: exception Glib.Critical("Gtk", "file gtkstyle.c: line 845 (gtk_style_attach): assertion `window != NULL' failed") Could somebody please tell me what's going on? Thanks :-) Mauri