I already told you that your errors about undefined references are because you forgot to link in all the GTK libraries.
GTK is made of a big set of related libraries. You need to link all of them, in a well defined order. And you also need to compile with a sequence of preprocessor flags, also in specific order. The pkg-config
utility will give you them:
pkg-config --cflags gtk+-3.0
list you all the compile flags (preprocessor includes mostly) needed by GTK3.
pkg-config --libs gtk+-3.0
list you all the libraries and linking options needed.
If your system has older than GTK3 libraries, you can list all packages known by pkg-config
On my system, that command gives more than two hundred entries. Choose the GTK package you want to use. Many systems have several versions of GTK installed (eg both GTK2 and GTK3).
I gave you, and the compilation command I gave you, both use pkg-config
. Don't try to guess which flags are needed to compile with GTK, use the pkg-config
utility to get them.
Basile Starynkevitch (France)