ada - 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*
and libncurses*
,因为我觉得它似乎是有益的。
我已经在 stackoverflow 上搜索了互联网和 Gtkada 社区,但没有成功。
因此,我想向您,Stackoverflow 社区的 Ada 专家和大师请教一些想法或我缺少的东西。
提前谢谢了。此致。
解决方案
问题:你不能直接在 Linux 上运行用 GtkAda 编写的程序。在启动程序之前,您必须始终使用脚本gtkada-env.sh
或等效的脚本来为与 GtkAda 捆绑的 Gtk 设置正确的路径和环境变量。
如果您想查看启动脚本的外观,这里有一个小示例:https ://github.com/thindil/hunter/blob/master/hunter.sh
如果您打算使用gtkada-env.sh
脚本,您只需要运行一次,因为它会创建一个具有正确路径和变量设置的新默认 shell
推荐阅读
- java - 如何将房间自动生成的主键作为外键添加到另一个实体
- chef-infra - MySQL Chef: NoMethodError: undefined method `set' for #
我正在尝试使用超市的 MySQL 食谱,但有一些例外
我的配置非常基本:
食谱:
mysql_service 'foo' do port '3306' version '5.5' initial_r
- c++ - C ++如何在两个类型不同的变量之间建立交换函数
- python - 为什么heroku不想上传我的项目?
- flutter - 在flutter中通过provider更新函数
- javascript - 从类方法 JavaScript 中调用构造函数
- flutter - 当按钮在父级中时,如何在按钮单击时从子级到父级获得价值?
- java - Snakeyaml:无法为
- python-3.x - 刮 Yelp 餐厅地址
- karate - 如何在空手道中使用 OR 运算符和 contains 来断言/匹配