Finding library package name is one of task that is cumbersome for the developer who has just started developing application for the Linux based operating system. why we need exact package name of installed library? The answer is very simple. An application most of the times needs dependent library, to be built. To build application the application source code needs to be linked with the dependent library. Here we are going to learn “using pkg-config command line tool for finding exact installed library’s package name”, thereafter we will learn how to link a library with an application source code using pkg-config tool.

To find exact name we should know at least some initial string of the library. For example to build a GUI application based on GTK+ library , gtk is initial string. To find out exact name of gtk library run following command on Linux terminal “pkg-config –list-all | grep gtk“.

How to find out exact library package name in Linux

After running “pkg-config –list-all | grep gtk” some outputs will be displayed on terminal screen, the list displayed would be such that left side is name of library and along the right side a simple description of the library. In the above figure shown we can see that gtk+-3.0 and gtk+-2.0 is the exact package name of gtk library. These are two different versions of gtk library installed in the system.

 Using Pkg-config tool for compiling and linking program

We have already discussed this topic in the post http://wikistack.com/using-pkg-config-tool-for-compiling-and-linking-program-2/ .