'How to use compile GTK in C on Mac OS

I'm getting started in c and would like to create GUI, so I tied using GTK.

I followed the tutorial they gave on https://www.gtk.org/docs/getting-started/hello-world/ , but when I get to compiling, I get this error:

--libs gtk4` -bash: pkg-config: command not found hello-world-gtk.c:2:10: fatal error: 'gtk/gtk.h' file not found #include <gtk/gtk.h>

how do I fix this!!! I downloaded it and everything, but it still doesn't work!

BTW the command used to run is: gcc main.c -o p1 pkg-config --cflags --libs gtk+-2.0

not sure if this has anything to do with it.

the main.c is in the desktop, and I made sure to cd to it, so that can't be the problem.



Solution 1:[1]

The error suggests that gtk.h can't be found in the typical include directory (/usr/local/include) or the current directory. Run

find /usr/local/include . -name gtk.h

to verify you actually have the gtk.h file. If you do, you may need to move it. If not, you need to download the file.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tjcaul