Ticket #1286 (new defect)

Opened 16 months ago

Last modified 16 months ago

gtk2hs on windows fails to run

Reported by: guest Owned by: somebody
Priority: normal Milestone: 0.13.0
Component: general (Gtk+, Glib) Version: 0.12.4
Keywords: haskell,gtk2hs,windows Cc: akegalj@…

Description

stackoverflow: http://stackoverflow.com/questions/17355541/gtk2hs-on-windows-fails-to-run

I wrote little app using gtk2hs on Linux and it works great. Latter I tryed to run that same app on Windows (xp, 7) but with no success. I installed:

1. haskell platform for win 2. gtk2hs all in one bundle in path with no spaces and set %PATH% to its /bin folder 3. cabal install gtk2hs-buildtools 4. cabal install gtk 5. ghc --make -O2 Main.hs And everything compiles and links OK. When trying to run that app it says:

c:\wordtrend>Main
(Main.exe:3228): GLib-GObject-CRITICAL **: gtype.c:2708: You forgot to call g_ty
pe_init()
(Main.exe:3228): GLib-GObject-CRITICAL **: gtype.c:2708: You forgot to call g_ty
pe_init()
(Main.exe:3228): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: as
sertion `G_TYPE_IS_INTERFACE (interface_type)' failed
(Main.exe:3228): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertio
n `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
(Main.exe:3228): GLib-GObject-CRITICAL **: gtype.c:2708: You forgot to call g_ty
pe_init()
(Main.exe:3228): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertio
n `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
(Main.exe:3228): GLib-GObject-CRITICAL **: gtype.c:2708: You forgot to call g_ty
pe_init()
(Main.exe:3228): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertio
n `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
(Main.exe:3228): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OB
JECT (object_type)' failed
Segmentation fault/access violation in generated code

I dont know where to start from.

Change History

in reply to: ↑ description   Changed 16 months ago by guest

SOLVED: So it appears there must be no commands before gtk2hs:initGUI function on Windows.

Code below works on Linux but compiles and chrases on Windows:

main :: IO () main = do

someCommand -- this command must come after initGUI to run initGUI ... mainGUI

So don't put any commands before initGUI command.

Note: See TracTickets for help on using tickets.