OS: Linux Mint 21.1 x86_64
As stated in GTK's official site (https://www.gtk.org/docs/installations/linux/) I downloaded the dev package for my distribution as:
sudo apt-get install libgtk-4-dev
The installation completed successfully and installed the contents to the folder below:
/usr/include/gtk-4.0
The folder structure is as follows:
gtk-4.0
------->gdk
------->gsk
------->gtk
------->unix-print
Thus, when I want to include gtk.h
for instance I need to write #include <gtk-4.0/gtk/gtk.h>
But an include statement such as this proves to be problematic, I first noticed this when my LSP raised an error such as In included file: 'gtk/css/gtkcss.h' file not found
next to #include <gtk-4.0/gtk/gtk.h>
The file which's existence is denied is there, but because in the source file gtk.h
it has been tried to access with the #include <gtk/css/gtkcss.h>
statement without gtk-4.0/
at the start it's obsolete. This problem occurs everywhere in the codebase.
Being naive, I thought that moving the contents of gtk-4.0
to usr/include
(I needed root access for that, which I think is a sign that that was not the optimal solution) would solve the problem. It did to some extent, but then it complained about not finding glib.h
which again was in a parent folder called glib-2.0
not deterring from my irrational way of a solution, I then proceeded to move the contents of that folder as well to usr/include
. Just as I thought that I had solved it, it started to complain about something else, at which point I got scared and reverted the possible damage inflicted on my include file with timeshift.
I have scoured the web in searches of an answer, but wasn't able to find anything of help. I would be grateful if someone happened to know the solution.
EDIT:
pkg-config --cflags --libs gtk4
after adding this to my gcc
arguments, I can compile my project. I also added the outputs of pkg-config --cflags gtk4
to my include directories and now my LSP picks up on auto-complete, but this is no good solution in my opinion I should be able to access it just by gtk/gtk.h
omitting the gkt-4.0/