From: Erik Max Francis Newsgroups: comp.lang.c++,comp.os.msdos.djgpp,gnu.g++.help Subject: Re: templates Date: Wed, 14 May 1997 10:04:04 -0700 Organization: Alcyone Systems Lines: 33 Message-ID: <3379F084.6C917A8B@alcyone.com> References: <01bc5fc6$6d16b7e0$0b88099a AT dennis DOT worldonline DOT nl> NNTP-Posting-Host: newton.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Dennis Janssen wrote: > When I try to compile it using DJGPP 2.01 (based on gcc 2.7.0.1) I think > I > get the following two errors: > > undefined reference to cStack::cStack(void) > undefined reference to cStack::push(int) It's because at link time it can't find the references to your template class. Remember that templates act like macros, and as such, have to be available at compile time, not link time. Change #include "cstack.h" to #include "cstack.cc" and it should work. If it doesn't, you'll have to explicitly instantiate the class, using something of the form class cStack; -- Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com Alcyone Systems / web / http://www.alcyone.com/max/ San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W \ "The future / is right there." / Bill Moyers