Suppose we have several header and library files in the same directory. If I don't know which library I should link against, can I programmatically determine which library must be used.

Lets say I tried to compile my code, and the linker complained about unresolved external symbols, Is there anything I can do, knowing that the correct library exists in the same directory?