Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .