Mail Archives: djgpp/1995/03/09/04:42:03
Yesterday, I sent the following message to this list:
> When I try to convert .o files into .a files, using ar, I find
> that the compiler refuses to read the resulting library:
>
> Assuming the file coll.o, compiled from coll.cpp using "gcc coll.cpp -c":
>
> >ar -sr libcoll.a coll.o
> (no error, but then running the library through the compiler:)
>
> >gcc libcoll.a
> libcoll.a: could not read symbols: No symbols
>
>
> I've tried using nm to list the symbols in libcoll.a:
>
> >nm -s libcoll.a
> ...libcoll.o: File format not recognized
>
> However, the coll.o file links fine into the compiler, when specified
> directly. Can anyone help?
As it turns out, kindly pointed out to me by Art S. Kagel, the -s
option in ar _isn't_ equivalent to running ranlib; it is non-
functional. Running "ranlib libcoll.a" solved my problem.
So, when compiling .o-files into libraries, use:
>ar -r lib<library>.a *.o
>ranlib lib<library>.a
Thank you, everybody who contributed!
-Finn
______________________________________________________
Finn Nielsen, AM MultiMedia
email: fnie AT login DOT dknet DOT dk fido: 2:238/117.15
snail: Rihiimakivej 6, DK-9200 Aalborg SV, DENMARK
phone: +45 98 18 96 77 fax: +45 98 18 63 09
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Raw text -