From owner-freebsd-questions Thu Nov 16 9:10: 9 2000 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-65-26-235-186.mmcable.com [65.26.235.186]) by hub.freebsd.org (Postfix) with SMTP id E2A7937B4C5 for ; Thu, 16 Nov 2000 09:10:06 -0800 (PST) Received: (qmail 63308 invoked by uid 100); 16 Nov 2000 17:10:06 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14868.5358.416403.621320@guru.mired.org> Date: Thu, 16 Nov 2000 11:10:06 -0600 (CST) To: Henrik Nilsson Cc: questions@freebsd.org Subject: Re: Creating libraries with "ar" fails... In-Reply-To: <52823016@toto.iv> X-Mailer: VM 6.75 under 21.1 (patch 10) "Capitol Reef" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Henrik Nilsson types: > I'm trying to create an archive file (libxmlnode.a) with one object file in it > (XmlNode.o), but when I link the archive file with my testprogram I get a lot > of undefined references. > > Below you can see the error message. > > The command I use to create the lib file is: > ar rs libxmlnode.a XmlNode.o > (with the s parameter you get the same result as running ranlib on the > archive later) > > Is there anything else I need to do in order to get it to work? > Or have I just forgot something? > > regards, > Henrik Nilsson > > ps. please reply to my emailaddress as well, as I'm not a member of this > mailinglist. Thanks! ds. > > - --error message--- > g++ -ggdb -Wall -pedantic -Wtraditional -Wshadow -Wpointer-arith -Wcast-qual > - -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-declarations > - -Wredundant-decls -Woverloaded-virtual -Winline -ansi -pipe > '-Dperror(x)={char buff[256]; sprintf(buff, "%s[%d]::%s() reported \"%s\" > with reason", __FILE__, __LINE__, __FUNCTION__, x); perror(buff);}' > libxmlnode.a main.cpp -o main Shouldn't the last few be: main.cpp libxmlnode.a -o main