Re: what is -l prefix for

Tassilo Horn <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization University Koblenz-Landau Campus Koblenz
Message-ID <[email protected]>
[email protected] writes:

Hi,

> Hello, In makefiles I have seen using like
>
>     -labc -lxyz  etc.
>
> What are they.

Have a look at the `ld' info page:

,----[ (info "(ld)Options") ]
| `-lARCHIVE'
| `--library=ARCHIVE'
|      Add archive file ARCHIVE to the list of files to link.  This
|      option may be used any number of times.  `ld' will search its
|      path-list for occurrences of `libARCHIVE.a' for every ARCHIVE
|      specified.
| 
|      On systems which support shared libraries, `ld' may also search
|      for libraries with extensions other than `.a'.  Specifically, on
|      ELF and SunOS systems, `ld' will search a directory for a library
|      with an extension of `.so' before searching for one with an
|      extension of `.a'.  By convention, a `.so' extension indicates a
|      shared library.
| 
|      The linker will search an archive only once, at the location
|      where it is specified on the command line.  If the archive
|      defines a symbol which was undefined in some object which
|      appeared before the archive on the command line, the linker will
|      include the appropriate file(s) from the archive.  However, an
|      undefined symbol in an object appearing later on the command line
|      will not cause the linker to search the archive again.
| 
|      See the `-(' option for a way to force the linker to search
|      archives multiple times.
| 
|      You may list the same archive multiple times on the command line.
| 
|      This type of archive searching is standard for Unix linkers.
|      However, if you are using `ld' on AIX, note that it is different
|      from the behaviour of the AIX linker.
`----


> Iam geeting a message like /usr/bin/ld: cannot find -labc .
>
> What file I need to include so that it compiles.

You can add the directory where `ld' should look for libabc with
-L/dir/of/libabc/.

HTH,
Tassilo
-- 
A child of five could understand this! Fetch me a child of five!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.