pkg-config is linux utility or tool which read meta data stored in .pc files. suppose you are going to write simple application using gtk library.gtk is GUI toolkit used by gnome linux desktop. if you don’t know the exact name of library you can list down by executing pkg-config –list-all.


#include <gtk/gtk.h>

int main( int argc, char *argv[])
GtkWidget *window;

gtk_init(&amp;argc, &amp;argv);

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);


return 0;

save this code in file win.c, and compile it by below command
gcc -o win win.c `pkg-config –libs –cflags gtk+-2.0`

The command `pkg-config –cflags` will give header information while `pkg-config –libs` gives library linker flags

Related Contents to follow