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?
In Alire I get Errors installing GtkAda and I am able to where the problem is. I have been able to install a newer version of gcc.
I installed the GNAT Studio with
gnatstudio-26.0w-20250417-x86_64-windows64-bin.exe.
Now I try to install Gtkada with:
Source code(zip)
Version v25.0.0
I just tried to install without Alire and found the problem I described earlier.At this moment I see only two things I can do:
- Just change the extension .gpd in .ads Is this save
- Just edit the file by deleting all lines beween two # 's and change extension.
Please give advise
Please, be descriptive with the errors that you are getting, explain the steps, system, environment where you got the error. It is very difficult to try to help someone when they do not give any information.
The installation of GTK-Ada from source is not trivial whatsoever. That is the reason the Alire method is recommended.
This error seems to be generated because you installed the Ada bindings but not the base GTK library and you are not linking directly to it. The linker is complaining that it cannot find the implementation of those functions as those are part of the base GTK library.
I created a how-to for installing GtkAda on a Windows machine.
I am busy t follow the script. In that script I got to the line " .configure --prefix=C:/gtkada " as I want to get my files in the directory C:\gnat\gtkada I used " .configure --prefix=C:/gnat/gtkada " Then got “configure error: in ‘/c/temp/gtkada-25.0.0’ configure error: no exceptable C compiler found in $PATH configure error: See ‘config.log’ for details”. I tried also the next line of the script "export…"but then it asked something with “>” and I do’t know what to answer.
Tthe configuration script /.configure --prefix=C:/gnat/gtkada fails with configure error: in ‘/c/temp/gtkada-25.0.0’ configure error: no exceptable C compiler found in $PATH configure error: See ‘config.log’ for details as it cannot find a C compiler in your PATH.
This means that you do not have GNAT/GCC in your PATH. The PATH is a special system variable where the command line/OS searches for programs available and uses them. This means that the Windows system that you are using does not have a C compiler in its PATH and therefore the ./configure script cannot find it and cannot compile the source code of GTK-Ada, which requires a suitable compiler.
There are two solutions:
- Add your C compiler to the PATH. Use an internet search engine on how to do this for Windows.
- Explicitly specify the C compiler that you want to use when running
./configure. This is done by indicating the specialCCvariable when running any program, such as./configure. This would look likeCC=/path/to/the/C/compiler.exe ./configure --prefix=...
Best regards,
Fer
This is a second message to create essential difference between two parts of my question
I have also tried to put all source files at known position and then compile “Hello World”. It start to compile the gtkada files and crashes when trying to compile gtkada-intl.adb. there seems no .ads present but a .gdp file which looks to be an ad. file bit there are strange statement in, for instance package body Gtkada.Intl is
pragma Warnings (Off);
#if GETTEXT_INTL then
pragma Linker_Options (“-lintl”);
#end if;
What to do with it? Are these strange line coped with by the script or Alire?
I do have Gcc.exe in the directory GNAT/bin and an older one in GNAT/GCC/bin both directories are in Path both in System variables as well as in the more personal one. Same fault. The newest one is 27-8-2025
You must follow the script. It instructs to install the compiler and modify PATH.
The compilers C, Ada and gprbuild must be in the PATH.