GPS 未在 Build & 运行 上显示 GTKAda 应用程序
GPS not showing GTKAda application on Build & Run
我想玩一下 GPS,我正在使用以下程序,该程序仅来自 GPS 生成的模板。
当我尝试构建 & 运行 时,我看不到 Window,但是如果我导航到创建可执行文件的文件夹,我可以 运行 可执行文件并看到window。我可以看到此选项卡已创建,但看不到我的应用程序。
with Gtk.Box; use Gtk.Box;
with Gtk.Label; use Gtk.Label;
with Gtk.Widget; use Gtk.Widget;
with Gtk.Main;
with Gtk.Window; use Gtk.Window;
procedure Main is
Win : Gtk_Window;
Label : Gtk_Label;
Box : Gtk_Vbox;
begin
-- 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);
-- Show the window
Win.Show_All;
-- Start the Gtk+ main loop
Gtk.Main.Main;
end Main;
我什至尝试确保我的程序是 运行,并将 Ada.Text_IO.Put_Line("Hello, World!");
放在源代码中,根据 [=25=,它似乎确实是 运行ning ] 选项卡。
这是因为它卡在了Gtk.Main.Main循环中。
要查看 window,您可以使用自定义 运行 命令 (Shift + F2) 并选中 "Run in an external terminal" 选项。
Configure External 1
单击“执行”按钮,您将看到 GtkWindow 启动并运行。
Configure External 2
我遇到了同样的问题。
您需要向链接器添加“windows GUI”指令。
转到 Project/Properties,在 Build/Switches/Ada 链接器下的字段中添加此指令
-Wl,--subsystem,windows
或者把它放在你的 gpr 文件的 Linker 部分,如下所示:
package Linker is
case Library_Type is
when "static" =>
for Switches ("ada") use ("-Wl,--subsystem,windows");
when "static-pic" =>
when "relocatable" =>
end case;
end Linker;
我想玩一下 GPS,我正在使用以下程序,该程序仅来自 GPS 生成的模板。
当我尝试构建 & 运行 时,我看不到 Window,但是如果我导航到创建可执行文件的文件夹,我可以 运行 可执行文件并看到window。我可以看到此选项卡已创建,但看不到我的应用程序。
with Gtk.Box; use Gtk.Box;
with Gtk.Label; use Gtk.Label;
with Gtk.Widget; use Gtk.Widget;
with Gtk.Main;
with Gtk.Window; use Gtk.Window;
procedure Main is
Win : Gtk_Window;
Label : Gtk_Label;
Box : Gtk_Vbox;
begin
-- 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);
-- Show the window
Win.Show_All;
-- Start the Gtk+ main loop
Gtk.Main.Main;
end Main;
我什至尝试确保我的程序是 运行,并将 Ada.Text_IO.Put_Line("Hello, World!");
放在源代码中,根据 [=25=,它似乎确实是 运行ning ] 选项卡。
这是因为它卡在了Gtk.Main.Main循环中。 要查看 window,您可以使用自定义 运行 命令 (Shift + F2) 并选中 "Run in an external terminal" 选项。
Configure External 1
单击“执行”按钮,您将看到 GtkWindow 启动并运行。
Configure External 2
我遇到了同样的问题。 您需要向链接器添加“windows GUI”指令。
转到 Project/Properties,在 Build/Switches/Ada 链接器下的字段中添加此指令
-Wl,--subsystem,windows
或者把它放在你的 gpr 文件的 Linker 部分,如下所示:
package Linker is
case Library_Type is
when "static" =>
for Switches ("ada") use ("-Wl,--subsystem,windows");
when "static-pic" =>
when "relocatable" =>
end case;
end Linker;