This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Builing a library
- From: "Tom Browder" <tom3 at fwb dot asi dot srs dot com>
- To: "'sundaresh venugopal'" <sundaresh at mail dot com>,<gcc-help at gcc dot gnu dot org>
- Date: Tue, 17 Jun 2003 08:19:23 -0500
- Subject: RE: Builing a library
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of sundaresh venugopal
>This is a basic beginners question. How do I build a library from a
>collection of .o files. I thought ar -rcs library.a files.o might work. But
>linking with this library return's undefined reference errors. If however
>I compile and link directly with the .o files ,the program compiles and
>works >properly.
The problem I believe is you are using the option "r" (replace)with
"c"(create). As I read the man page, if you use "r" and the member doesn't
exists, you will get an error message and the archive will NOT be changed.
(I'll bet the size of your library is nearly zero bytes.) Try executing "ar
-cs library.a [f1.o f2.o ...]" and that should work.
Tom Browder
SRS Technologies, Inc.
838 N. Eglin Parkway, Suite 202
Fort Walton Beach, FL 32547
Tel: 850-862-4188
Fax: 850-862-8055