From owner-freebsd-questions Thu Nov 16 1:25:16 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail.west.se (unknown [194.52.130.37]) by hub.freebsd.org (Postfix) with ESMTP id EBBC037B479 for ; Thu, 16 Nov 2000 01:25:12 -0800 (PST) Received: from sleepy.west.se (sleepy [192.168.0.13]) by mail.west.se (8.11.0/8.9.3) with ESMTP id eAG9PBs18521 for ; Thu, 16 Nov 2000 10:25:11 +0100 (CET) (envelope-from Henrik.Nilsson@west.se) Message-Id: <200011160925.eAG9PBs18521@mail.west.se> Date: Thu, 16 Nov 2000 10:25:10 CET From: Henrik Nilsson To: freebsd-questions@freebsd.org Subject: Creating libraries with "ar" fails... Reply-To: Henrik.Nilsson@west.se X-Mailer: Spruce 0.6.5 for X11 w/smtpio 0.7.9 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 /tmp/ccV10584.o:/usr/include/g++/std/bastring.cc:159: undefined reference to `XmlNode::XmlNode(basic_string, __default_alloc_template > const &, basic_string, __default_alloc_template > const &)' /tmp/ccV10584.o:/usr/include/g++/std/bastring.cc:165: undefined reference to `XmlNode::~XmlNode(void)' /tmp/ccV10584.o:/usr/include/g++/std/bastring.cc:172: undefined reference to `XmlNode::setAttribute(basic_string, __default_alloc_template > const &, basic_string, __default_alloc_template > const &)' /tmp/ccV10584.o:/usr/include/g++/std/bastring.cc:177: undefined reference to `XmlNode::toString(void) const' /tmp/ccV10584.o: In function `main': /home/khn/code/disco/util/xmlnode/main.cpp:13: undefined reference to `XmlNode::~XmlNode(void)' *** Error code 1 Stop in /home/khn/code/disco/util/xmlnode. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message