I know the similar question to this, this ain't it; although my case is extremely similar. The first 4 lines of the Code::Blocks "Hello World" program when you open a new GTK project are this:
#include <stdlib.h>
#include <gdk/gdk.h>
static void helloWorld (GtkWidget *wid, GtkWidget *win)
And the compiler build log goes as follows (with every instance of the type flagged, I only inlcuded the first for brevity):
-------------- Build: Debug in graphics project (compiler: GNU GCC Compiler)---------------
gcc -Wall -g -I/usr/include/gtk-4.0/ -I/usr/include/glib-2.0/ -I/usr/lib64/glib-2.0/include/ -I/usr/include/cairo/ -I/usr/include/pango-1.0/ -I/usr/include/harfbuzz/ -I/usr/include/gdk-pixbuf-2.0/ -c "/home/********/Documents/graphics project/main.c" -o obj/Debug/main.o
gcc -o "bin/Debug/graphics project" obj/Debug/main.o
/home/********/Documents/graphics project/main.c:4:25: error: unknown type name ‘GtkWidget’
4 | static void helloWorld (GtkWidget *wid, GtkWidget *win)
| ^~~~~~~~~
What?!? The GTK documentation states that 'GtkWidget' is the base class for darn near everything. I frankly don't know how this is possible. By way of explanation, the one thousand and one -I (as in India) directories here are because for some reason when I installed the GTK4 toolkit via command line, it put quite a few dependencies inside sub folders in the /usr/include/ directory and of course you can't tell the compiler to search all sub folders. The specific command I used to install GTK was
sudo yum install gtk4-devel
and I'm on Fedora 35 workstation running Code::Blocks version 20.03 and gcc-c++-11.2.1-9.fc.35.x86_64, if any of those things make a difference here. I even uninstalled GTK4 and reinstalled it, just to see if that would fix it--nope. I'm very new to programming in general and GUIs in particular, and I basically just wanted to screw around with the "Hello World" program without any specific goal in mind. I just want to learn. But this sort of thing has given me unending grief since minute one of trying to learn programming, and this time I can't Google the answer. Oh well, first time for everything.
pkg-config, e.g. generally`pkg-config --cflags --libs gtk4`You can simply run that at the command line and it will spit out the configuration. That is generally included in the Makefile for that purpose. Hope you have better luck making gtk4 look presentable than I did. Bland...:)