I have a header file, for example “elf.h” or name of method, for example “ElfData::addToSection()”.
I’d like to know the corresponding library file – the name of it and it’s location, for example /usr/lib/libelf.a, or /usr/lib/libelf.so.0.8.13.
What are the ways to solve this problem. And what is the best way.
Also i’d like to know what headers, functions match to specified library file.
Operational system = Ubuntu Linux.
May be, these questions are stupid 🙂
but I would appreciate it if you could reply.
For newer libraries, you can often use the
pkg-configtool. You give this the name of the package you want to link with and it gives you the appropriate compiler/linker options:so that you can put this in your
Makefile:(It won’t find the headers for you, just the include dirs.)
For libraries that do not support
pkg-config, there’s no single correct way of finding out the header that a library belongs to or vice versa. You normally either hand-code this knowledge into your build system, or use something like the GNU autotools that allow checking multiple libraries/headers for the identifiers or symbols you need.