Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Nov 2000 10:25:10 CET
From:      Henrik Nilsson <Henrik.Nilsson@west.se>
To:        freebsd-questions@freebsd.org
Subject:   Creating libraries with "ar" fails...
Message-ID:  <200011160925.eAG9PBs18521@mail.west.se>

next in thread | raw e-mail | index | archive | help

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<char, string_char_traits<char>,
__default_alloc_template<false, 0> > const &, basic_string<char,
string_char_traits<char>, __default_alloc_template<false, 0> > 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<char, string_char_traits<char>,
__default_alloc_template<false, 0> > const &, basic_string<char,
string_char_traits<char>, __default_alloc_template<false, 0> > 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011160925.eAG9PBs18521>