Originally Posted by
cas
Perhaps there should be an automatic way for a compiler/linker combination to determine what libraries are needed when linking, but that ship has sailed. When it comes to 3rd party libraries, you just have to know what to link in. pkg-config fixes this problem to some degree, by making it so you only have to know the package name, not the library name(s).
Actually there is a way to correlate headers with libs...
Code:
#pragma comment(lib,libname.lib)
#pragma lib "libname.lib"
If your compiler supports it, these can inserted into the .h files to automatically find and include the correct libraries.
I don't know how extensive the usage is elsewhere... but Pelles C does this with windows headers. You include the header and the linker is informed which library to use... extremely handy.