delorie.com/archives/browse.cgi | search |
From: | "John Bodfish" <bodfish AT als DOT ameritech DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Template problem. |
Date: | 4 Jun 1997 16:17:17 GMT |
Organization: | Ameritech Library Services |
Lines: | 27 |
Message-ID: | <01bc7102$7d3aa580$dfcde7c0@JOHNB.als.ameritech.com> |
References: | <5n1cn4$ns3 AT lion DOT cs DOT latrobe DOT edu DOT au> |
NNTP-Posting-Host: | n5223.als.ameritech.com |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Gregary J Boyles <boylesgj AT lion DOT cs DOT latrobe DOT edu DOT au> wrote in article <5n1cn4$ns3 AT lion DOT cs DOT latrobe DOT edu DOT au>... > What am I doing wrong with this friggin template class.? > gxx -fno-implicit-templates test.cc > test.o: In function `main': > test.cc:15: undefined reference to `StackQueueC<int>::StackQueueC(void)' > test.cc:30: undefined reference to `StackQueueC<int>::~StackQueueC(void)' > > void main() > { > StackQueueC<int> S; > } (template definitions omitted) Insert the following two lines prior to your first use of the StackQueueC template in main (e.g., before the "void main()" line): template class StackQueueC<int>; template class NodeC<int>; This instantiates the templates for the "int" datatype. See the node "Template Instantiation" in gcc.info for the gory details. -- John Bodfish bodfish AT als DOT ameritech DOT com
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |