I've been using the command gcc file.c -o program $(pkg-config --cflags --libs gtk+-2.0) -Wall to compile it. You can optionally add "x11 gdk-x11-2.0" before gtk+2.0 in the pkg-config line but it's not technically required as gtk+2.0 will automatically include them