使用 Gnat-2020-Community 版本和 Gtkada 我尝试在 Debian 10.2 (x86_64 GNU/Linux) 上创建一个简单的 gui。
该项目基于“从模板创建项目”对话框中的 GtkAda 的“简单窗口”项目(我假设代码开箱即用)。
-- Initialize GtkAda.
Gtk.Main.Init;
-- Create a window with a size of 400x400
Gtk_New (Win);
Win.Set_Default_Size (400, 400);
-- Create a box to organize vertically the contents of the window
Gtk_New_Vbox (Box);
Win.Add (Box);
-- Add a label
Gtk_New (Label, "Hello world.");
Box.Add (Label);
-- Stop the Gtk process when closing the window
Win.On_Delete_Event (Delete_Event_Cb'Unrestricted_Access);
-- Show the window and present it
Win.Show_All;
Win.Present;
-- Start the Gtk+ main loop
Gtk.Main.Main;
除了调整'with "gtkada";' 没有应用任何变化。到项目的 gpr 文件中 gtkada.gpr 文件的正确路径。
GtkAda 被正确检测到。该项目在静态和可重定位配置中均成功构建。
但是,程序无法成功运行,但在执行时会生成此终端输出 Win.Show_All;
:
/home/user/workspace_ada/Simple_Window/Simple_Window/obj/main
Fontconfig warning: "/home/user/workspace_ada/gnat-2020/etc/fonts/fonts.conf", line 86: unknown element "blank"
(main:4012): Gtk-WARNING **: 21:38:39.988: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /home/user/workspace_ada/gnat-2020/share/icons/Adwaita/16x16/status/image-missing.png: Format der Bilddatei unbekannt (gdk-pixbuf-error-quark, 3)
raised PROGRAM_ERROR : unhandled signal
[2020-08-20 21:38:40] process exited with status 1, elapsed time: 00.30s
我已经按照 Gtkada 的要求安装了以下软件包:libglib*
, libgtk*
.
此外,我还安装了libx11*
and libncurses*
,因为我觉得它似乎是有益的。
我已经在 stackoverflow 上搜索了互联网和 Gtkada 社区,但没有成功。
因此,我想向您,Stackoverflow 社区的 Ada 专家和大师请教一些想法或我缺少的东西。
提前谢谢了。此致。