Mail Archives: djgpp/2004/12/17/13:15:22
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 -