From owner-freebsd-hackers Fri Jan 31 17:16:02 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id RAA26500 for hackers-outgoing; Fri, 31 Jan 1997 17:16:02 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id RAA26473 for ; Fri, 31 Jan 1997 17:15:59 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id SAA03677; Fri, 31 Jan 1997 18:14:33 -0700 From: Terry Lambert Message-Id: <199702010114.SAA03677@phaeton.artisoft.com> Subject: Re: g++, STL and -frepo on FreeBSD-2.2-Beta To: bakul@torrentnet.com (Bakul Shah) Date: Fri, 31 Jan 1997 18:14:33 +73700 (MST) Cc: hackers@freebsd.org In-Reply-To: <199701311808.NAA14384@chai.plexuscom.com> from "Bakul Shah" at Jan 31, 97 01:08:01 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > cat >x.cc < #include // include everything for simplicity. > #include > #include > > int main(int, char*[]) { > list list1; > for(int i = 0; i < 10; ++i) { > list1.push_back(rand()); > } > return 0; > } > EOF > > g++ -frepo -c x.cc > g++ -o x x.o > > The last step above should call the compiler to instantiate the > list class and everything should just work. No such luck. I > get: > > x.o: Undefined symbol `list::list(void)' referenced from text segment ********************* constructor > x.o: Undefined symbol `list::push_back(int const &)' referenced from text segment ********************************* type member > x.o: Undefined symbol `list::~list(void)' referenced from text segment ********************** destructor It can't call the constructor, used implicitly in the list1 auto declarator. It can't call the destructor, called implicily when the list1 auto storage goes out of scope of main(). It can't call the push_back member function, which is explicitly called. Clearly, the template class definition template class list ... { ... }; is not in scope. The header files you have included are apparently not sufficient. Perhaps you meant "List" instead of "list"??? Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.