Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

e.g. the math lib is -lm the openmotif lib is -lXm

how are these dtermined (so as to avoid conflicts) and where are these abbrevs noted? in the Makefile? (if they must be passed to the compiler)

i'm doing some research on dependencies (e.g. with ldd and nm) and that is why i want to know.

share|improve this question

1 Answer 1

The abbreviations are just a shortening of the library name the linker needs to use to find the library code to bind in. For example, -lXm tells the linker to look for either libXm.so or libXm.a, depending on whether it is doing dynamic or static binding. There is no general mechanism to avoid conflicts when naming libraries. The author of the library chooses a name and generally tries to avoid choosing a name which conflicts with any other libraries, especially the standard system libraries.

The linker does need to know which libraries are to be linked into an executable. If the compile and link step is being driven from 'make', then the Makefile will cause the compiler to be called with -l flags that specify the libraries to be used.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.