delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/12/17/13:15:22

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Fausto Arinos Barbuto" <fbarbuto2002 DOT no AT w1 DOT ca DOT vip DOT scd DOT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Linking libraries
Date: Fri, 17 Dec 2004 11:02:57 -0700
Lines: 48
Message-ID: <32glahF3lqibgU1@individual.net>
References: <32gj6cF3mhujqU1 AT individual DOT net> <200412171735 DOT iBHHZp1D014849 AT envy DOT delorie DOT com>
X-Trace: individual.net FeyLBItn3DUMawewFWOIFwZo845r9VPgTy16RZtss8LeW6I4oz
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi DJ,

    Thanks for your reply. Your help was much appreciated.

    I did what you suggested and it worked. Now I can create
    an executable with the following one-line command:

    gcc -O3 -o test.exe test.cpp -lapfloat -lm -lstdcxx

    ("gpp" also works). The EXE runs as intended.

    Thanks again.

---Fausto


"DJ Delorie" <dj AT delorie DOT com> wrote in message
news:200412171735 DOT iBHHZp1D014849 AT envy DOT delorie DOT com...
>
> >     gcc -o test.exe test.c -l apfloat.a
> >
> >     gcc -c test.c
> >     gcc test.o apfloat.a -o test.exe
>
> What you should have done is kept the file (apfloat.a) in the same
> directory as the objects (test.o), and treated it like any other
> object (that's all a library is, is a collection of objects).
>
> The moving it to the system library directory thing is for system
> libraries.  To use that feature, you must do ALL of the following:
>
> 1. Move the file to the djgpp\lib directory.
>
> 2. Rename the file to have a "lib" at the beginning and ".a" at the
>    end.  For example: libapfloat.a
>
> 3. Use the -l option to indicate the MIDDLE part of the name.  For
>    example: -lapfloat for the above libapfloat.a
>
> The "-l" option does not specify a file name, it specifies a library
> ID.  How gcc uses that to find the library file varies from system to
> system (for example, mips platforms often have multiple libapfloat.a
> files in multiple directories, which one is chosen depends on other
> gcc options like big/little endian or soft/hard float; on linux
> systems it looks for /lib/libapfloat.so, etc).


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019