Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build GTK+ application in Ada - GtkAda

Tags:

gtk3

ada

I'm trying to develop to the first time a GTK+ application in Ada, with GtkAda. I installed it, and I could build a Hello World application from the "Simple Window" template proposed by GPS.

But, when I want to run it, I become an error popup with this message:

"gdk_device_get_last_event_window" could not be found in the DLL "[path_to_my_project]\obj\main.exe".

It was linked with the static library. If I try to link with the relocatable library (using GPS scenario variable LIBRARY_TYPE), I got almost the same error:

"gdk_cairo_surface_create_from_pixbuf" [...]

This second error appears too if I try to launch sample applications (testgtk.exe or test_rtree.exe) from [gtkada_dir]\share\examples\gtkada\testgtk.

So, did I missed something at the installation of GtkAda?

I run Windows 8.1, I installed GtkAda into the default folder (C:\GtkAda - note I tried to install it into C:\GNAT\2016 too, but the problem is the same).

My PATH includes C:\GtkAda\bin;C:\GtkAda\lib, I added another environment variable ADA_PROJECT_PATH=C:\GtkAda\lib\gnat.

I installed Gnat from the latest version (20160515-49).

Any idea to get GtkAda applications running?

Thanks for your help.

like image 991
François R. Avatar asked Dec 06 '25 08:12

François R.


1 Answers

It's easier if you use the Alire package manager, install a newer GNAT studio from https://github.com/AdaCore/gnatstudio/releases (click at the Assets link to download the installers) and then install Alire from https://alire.ada.dev/

Once alire is installed just create a new project with gtkada with the commands:

alr init --bin holagtk
cd holagtk
alr with gtkada
alr run

If you want to upgrade an old project to Alire, you may run the commands:

cd oldgtkproject
alr init --in-place --no-skel --bin oldgtkproject
alr with gtkada
alr run

You may need to edit the generate project a little bit

IMPORTANT: The gtkada package does not work when your user home path or your project contains whitespaces, ensure you use paths like /home/user1, /opt/gnatstudio, /opt/alire, etc.

like image 56
Carlos Saltos Avatar answered Dec 09 '25 16:12

Carlos Saltos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!