I’m running Ubuntu 21.10 and have installed build-essential, libgtk-4-dev and Gnome Builder as IDE. I’m starting with a basic tutorial that starts out #include <gtk/gtk.h> but it gives the error:
1:10: error: 'gtk/gtk.h' file not found
I read somewhere that it should be in /usr/include/ but when I looked I found it was at /usr/include/gtk-4.0/gtk/gtk.h
What’s the best way to set up my system so that the default include line works? I read gtk - How to compile a GTK4 application in Ubuntu 21.10? - Ask Ubuntu but his fix was installing libgtk-4-dev which I’ve already done. I thought of creating a symlink from /usr/include/gtk-4.0/gtk/gtk.h to /usr/include/ but that seems like a rabbit hole I shouldn’t go down. I’m stuck before I even got started! Any help appreciated.
The first two examples show what pkg-config --cflags gtk4 and pkg-config --libs gtk4 print out to the terminal. For instance, this is what they print out in my environment:
This is only needed if you’re manually compiling with the C compiler from the terminal.
If you’re writing an application with GNOME Builder, you can follow the “Getting Started” tutorial on the GNOME developer documentation website, as I already said in my reply.
Follow the instructions there on how to create a template application; Builder will download all the dependencies inside the build environment, and you won’t have to deal with the command line.