I have installed GNAT Studio, gcc (with Alire) and GtkAda all on C:. Now I use these on Hello_World_Gtkada. I solved all the errors in the program lines of the .abs and .adb files. In fact all with adding directories in Path(es). So all Path items are resolved.
I have tried Build all and the program is build wirhou errors
How get in Build & Run:
D:\ada\project\Hello_World_Gtkada\gtk-window.o:gtk-window.adb:(.text+0x31f3): undefined reference to `gtk_window_set_default’
and a big number if these more.I am using the latest version of GPS and Gtkada
How can I solve this
The simplest way is to use Alire. Try this:
alr init --bin my_gtk_app
cd my_gtk_app
alr with gtkada
# Edit src/my_gtk_app.adb
alr run
The my_gtk_app.adb could be as simple as this:
with Gtk.Main, Gtk.Window;
procedure Simple_Application is
Window : Gtk.Window.Gtk_Window;
begin
Gtk.Main.Init;
Gtk.Window.Gtk_New (Window);
Gtk.Window.Show (Window);
Gtk.Main.Main;
end Simple_Application;
I used for testing Hello World for GtkAda because that was on internet used for testing GtkAda:
with Gdk.Event;
with Gtk; use Gtk;
with Gtk.Main;
with Gtk.Label; use Gtk.Label;
with Gtk.Window; use Gtk.Window;
with Gtk.Widget; use Gtk.Widget;
with Gtk.Table; use Gtk.Table;
–with Gtk.Main;
with Ada.Unchecked_Conversion;
procedure Hello_World_Gtkada is
Window : Gtk_Window;
Grid : Gtk_Table;
Label : Gtk_Label;
type Event_Callback is not null access function
( Self : access Gtk_Widget_Record’Class;
Event : Gdk.Event.Gdk_Event
) return Boolean;
function “+” is
new Ada.Unchecked_Conversion
( Event_Callback,
Cb_Gtk_Widget_Gdk_Event_Boolean
);
type Destroy_Callback is access procedure
( Widget : access Gtk_Widget_Record’Class
);
function “+” is
new Ada.Unchecked_Conversion
( Destroy_Callback,
Cb_Gtk_Widget_Void
);
function Delete_Event_Handler
( Widget : access Gtk_Widget_Record’Class;
Event : Gdk.Event.Gdk_Event
) return Boolean is
begin
return False;
end Delete_Event_Handler;
procedure Destroy_Handler
( Widget : access Gtk_Widget_Record’Class
) is
begin
Gtk.Main.Main_Quit;
end Destroy_Handler;
begin
Gtk.Main.Init;
Gtk.Window.Gtk_New (Window);
Window.Set_Title (“Hello World_Gtkada”);
Window.On_Delete_Event (+Delete_Event_Handler’Access);
Window.On_Destroy (+Destroy_Handler’Access);
Gtk_New (Grid, 1, 1, False);
Window.Add (Grid);
Gtk_New (Label);
Label.Set_Text (“Hello World_Gtkada”);
Grid.Attach (Label, 0, 1, 0, 1);
Label.Show;
Grid.Show;
Window.Show;
Gtk.Main.Main;
end Hello_World_Gtkada;
In the mean time I found: Using “Compile all sources” made this type off failure disappear That could mean The failre occurred in Linking but also another failure appeared:
gprbuild -c -U -d -PD:\ada\project\Hello_World_Gtkada\hello_world_Gtkada.gpr
Compile
[Ada] gtkada-intl.ads
cannot generate code for file gtkada-intl.ads (package spec)
[2026-01-21 12:09:04] process exited with status 4, 77% (279/360), elapsed time: 01.57s
I found that in the listing of gtkada-intl.ads shown as gtkada-intl.gpd with parts that looked like:
#if GETTEXT_INTL then
pragma Linker_Options (“-lintl”);
#end if;
or
#if HAVE_GETTEXT then
return Value (Internal (Msg & ASCII.NUL));
#else
return Msg;
#end if;
How ca I solve that
I have no idea what version of GtkAda you have, how did you install it, why it has preprocessor’s directives and why it doesn’t have gtkada-intl.adb for gtkada-intl.ads.
Why Alire solution doesn’t work for you?