Hello-world-gtk.c don't compile

https://www.gtk.org/docs/getting-started/hello-world/

say on my Ubuntu LTS :

$ gcc $(pkg-config --cflags gtk4) -o hello-world-gtk hello-world-gtk.c $(pkg-config --libs gtk4)
hello-world-gtk.c: In function ‘main’:
hello-world-gtk.c:34:49: error: ‘G_APPLICATION_DEFAULT_FLAGS’ undeclared (first use in this function); did you mean ‘G_APPLICATION_GET_CLASS’?
   34 |   app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                 G_APPLICATION_GET_CLASS
hello-world-gtk.c:34:49: note: each undeclared identifier is reported only once for each function it appears in

You need a more recent version of GLib, or you can replace G_APPLICATION_DEFAULT_FLAGS with 0.

Using an LTS release for development is going to be painful; you should use a base OS with a quicker update cadence, or use Flatpak.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.