Mail Archives: djgpp/2004/12/17/12:36:03
> 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 -