In static linking, how does the linker knows which library file to link the user’s compiled object code against? I mean the header only contains the function protoytpes that may be used in the source code, not the library file name.. isn’t it?
Share
That’s why you provide the linker with a list of libraries to link against!
e.g. for GCC, you might do something like:
Here, the
-lflag is used to tell the linker to link againstlibmandlibpthread.