Date: Thu, 9 Mar 1995 08:54:19 +0100 (MET) From: Finn Nielsen Sender: fnie AT login DOT dknet DOT dk Reply-To: fnie AT login DOT dknet DOT dk To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Solved: Archiving .o-files into .a-library 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.a *.o >ranlib lib.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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~