From: bena AT NOSPAMsirplc DOT co DOT uk (Ben Ashley) Newsgroups: comp.os.msdos.djgpp Subject: Re: Templates with GCC Date: Wed, 07 Jan 1998 09:07:13 GMT Organization: Areti Internet Public News Service Lines: 61 Message-ID: <34b344cf.315411@news.areti.co.uk> References: <01bd1b0b$5db0cce0$a844e4cf AT cadvision DOT com> Reply-To: bena AT sirplcNOSPAM DOT co DOT uk NNTP-Posting-Host: 194.130.222.18 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 On 7 Jan 98 01:28:02 GMT, "Robert Lazorko" wrote: >I am having trouble compiling using templates - although all of my code >syntax is C++ compatible. I have reason to believe that the compiler may >require some special instructions for using templates. If any one has any >help or ideas, please mail me. > >Thanks in advance! The way I do template classes is as follows: in myclass.h: #ifndef A_H #define A_H template< class T >class A { public: A(); }; #ifndef A_IMPLEMENTATION #define A_IMPLEMENTATION #include "A.cc" #endif // A_IMPLEMENTATION #endif // A_H in myclass.cc: template< class T > A< T >::A() { }; A few points... don't include the .cc file in your project, and don't include the .h file in the .cc file. Cheers, MooBen Programmer for some people I can't quite remember "Winnie says he's *Not* In-Animate"