GtkAda简单窗口:找不到pixbuf加载程序或mime数据库

问题描述

使用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*libncurses*,因为我感觉这将是有益的。

关于这个主题,我在stackoverflow上搜索了互联网和Gtkada社区,但均未成功。

因此,我想问您,Stackoverflow社区的Ada专家和专家,关于想法或我缺少的东西。

非常感谢。最好的问候。

解决方法

问题:您不能直接在Linux上运行用GtkAda编写的程序。在启动程序之前,必须始终使用脚本gtkada-env.sh或等效的脚本来启动与GtkAda捆绑在一起的Gtk的正确路径和环境变量。

如果要查看启动脚本的外观,请举一个小示例:https://github.com/thindil/hunter/blob/master/hunter.sh

如果您打算使用gtkada-env.sh脚本,则只需运行一次,因为它会创建具有正确路径和变量设置的新默认外壳程序

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...