delorie.com/archives/browse.cgi | search |
From: | "Al Combs" <acombs AT uiuc DOT edu> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Templates? What templates? |
Date: | Fri, 24 Sep 1999 22:04:28 -0500 |
Organization: | University of Illinois at Urbana-Champaign |
Lines: | 60 |
Message-ID: | <7shdud$fnl$1@vixen.cso.uiuc.edu> |
References: | <Pine DOT SUN DOT 3 DOT 91 DOT 990923112447 DOT 10652b-100000 AT is> <7sgp47$svt$1 AT vixen DOT cso DOT uiuc DOT edu> <37ed04ed DOT 4818379 AT news DOT clara DOT net> |
NNTP-Posting-Host: | spider.cso.uiuc.edu |
X-Newsreader: | Microsoft Outlook Express 4.72.3110.5 |
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3 |
X-Proxy-Client: | acombs AT uiuc DOT edu from PPPa30-ResaleChampaign1-4R1141.saturn.bbn.com |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Yes, I tried it in CC, and it works fine. G++ gives an error like: main.o(.text+0xe):main.C: undefined reference to `Array<int>::Array(void)' And what do you mean "move the template definition?" I've tried commenting out template<class Etype> in the array.C file, and it still gave me the same error. Specifically what changes would you recommend? George Ryot wrote in message <37ed04ed DOT 4818379 AT news DOT clara DOT net>... > >> in my array.h file: >> >> template<class Etype> >> class Array >> { >> public: >> Array(void); >> >> private: >> Etype y; >> }; >> >> in array.C: >> >> #include "array.h" >> >> template<class Etype> >> Array<Etype>::Array(void) >> { >> y = 0; >> } >> >> in main.C: >> >> #include "array.h" >> >> int main(void) >> { >> Array<int> x; >> >> return 0; >> } > >Try moving the template definition from array.C to array.h > >Did you test this with CC? > >> >> When is g++ gonna support the standard? >> > >> >AFAIK, g++ supports the standard. Please post sample code that is >> >accepted by CC (on what platform, btw? CC doesn't tell anything about the >> >machine and the OS) but rejected by g++. >> > >> >Also, what version of g++ are you using? > >-- >george
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |