Reputation: 83
I am trying to learn gtk and following this link : http://zetcode.com/gui/gtk2/firstprograms/ I was able to get a basic program to run. The way to compile the code was to use the command:
gcc -o simple simple.c `pkg-config --libs --cflags gtk+-3.0`
I want to understand what the flags pkg-config --libs --cflags gtk+-3.0
mean.
I tried searching the man page for the flags pkg-config
, --libs
and --cflags
, but couldn't find them. I would feel fairly satisfied if I understood what that snippet of text inside the `` actually means.
Upvotes: 3
Views: 2788
Reputation: 12404
To compile a program using GTK+ 3.0 you need to provide compile options to tell the compiler where to look for include files and library files.
You can either specify them directly with the appropriate compiler options.
Or you can use the flags that were configured when you installed the GTK+ packages.
These flags can be retrieved using pkg-config
command.
Putting the command in `` causes the content to be executed and being replaced by the output of the command.
This will provide the compile flags (--cflags
) and library options (--libs
) needed to build your application.
Upvotes: 5