2013-06-28 92 views
3

我在Linux上使用gtk2hs編寫了一個小應用程序,它工作的很好。後來我嘗試在Windows(xp,7)上運行相同的應用程序,但沒有成功。我安裝:在windows上gtk2hs無法運行

  1. Haskell的平臺,爲勝利
  2. gtk2hs所有在沒有空格的路徑中的一個包,並設置%PATH%到它的/ bin文件夾
  3. 小集團安裝gtk2hs,編譯工具
  4. 小集團安裝GTK
  5. GHC --make -02 Main.hs

而且一切編譯和鏈接OK。當試圖運行該應用程序它說:

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 

我不知道從哪裏開始。

回答

0

已解決:因此在gtk2hs:Windows上的initGUI函數之前必須沒有命令。下面

守則適用於Linux,但編譯和chrases在Windows上:

main :: IO() 
main = do 
    someCommand -- this command must come after initGUI to run 
    initGUI 
    ... 
    mainGUI 

所以不要initGUI命令之前提出的任何命令。