如何解决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
脚本,则只需运行一次,因为它会创建具有正确路径和变量设置的新默认外壳程序
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。