| delorie.com/archives/browse.cgi | search |
| From: | Endlisnis <s257m AT unb DOT ca> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: HELP with templates |
| Date: | Thu, 13 May 1999 19:15:42 -0400 |
| Organization: | BrunNet |
| Lines: | 27 |
| Message-ID: | <373B5D1E.E91C5DD0@unb.ca> |
| References: | <37397EE0 DOT ADFF172 AT camserv DOT unicam DOT it> |
| NNTP-Posting-Host: | ftnts3c15.brunnet.net |
| Mime-Version: | 1.0 |
| X-Mailer: | Mozilla 4.51 [en] (Win95; U) |
| X-Accept-Language: | en |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Renato De Leone wrote:
> Maybe this is a FAQ but I was unable to find the answer. What is wrong?
> What do I need to add to correctly compile and run the program?
>
> -----------array.cc------------------
>
> #include "array.h"
>
> template <class X> X & Array<X>::set(int k)
> {
> return data_[k];
> }
You can't compile a template file separetly from the main program. Include the
template function implimentation in the h file and it should work fine.
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT HotMail DOT com
ICQ: 32959047
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |