我在Linux上使用gtk2hs编写了一个小应用程序,效果很好。后来我试图在Windows上运行相同的应用程序(xp,7),但没有成功。我安装了:
一切都可以编译并链接好。当试图运行该应用程序时,它说:
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 :(得分:0)
解决:所以看来在Windows上gtk2hs:initGUI函数之前必须没有命令。
以下代码适用于Linux,但在Windows上编译和删除:
main :: IO ()
main = do
someCommand -- this command must come after initGUI to run
initGUI
...
mainGUI
所以不要在initGUI命令之前输入任何命令。