delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/20/18:06:34

From: Ian Miller <itm AT shelob DOT plus DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Odp: Library with templates - help !!!!!!!!!!!!!
Date: Sat, 20 Jan 2001 16:28:33 -0000
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <t6jf5hsbjr8k83@corp.supernews.co.uk>
Sender: itm AT shelob
References: <94c3au$791$1 AT info DOT cyf-kr DOT edu DOT pl> <ul8j6tofuvdpb22ms23d9ld99sr7hk3k25 AT 4ax DOT com> <94cba9$5a0$1 AT info DOT cyf-kr DOT edu DOT pl>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.91
MIME-Version: 1.0
X-Complaints-To: newsabuse AT supernews DOT com
Lines: 28
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Rafal Maj" <maj_rafal AT poczta DOT onet DOT pl> writes:

> Yes,
> but when definiton (in real program - very long) of my class is in box.h,
> then it is re-compiled every time, with can take very much time.

What Jason Green showed you is the normal way of writing template
classes and their functions...

> I want to
> have definition in other .cc file to re-compile it only when necessary, in
> bug.h I want only definition of my class.

...and this isn't.  (I believe you mean "declaration" by the way.)

> When I write definition of normal class in my library *.cc file - OK
> When I write definition of  template class in my main *.cc file - OK
> When I write definition of  template class in my library *.cc file - error !

That's just the way template classes work, I'm afraid.
(So far as I know anyway.)

Some compilers can "compile the headers" on order to answer
your objection to writing the code correctly, but I don't
think gcc does so yet.

Regards,
Ian

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019