From: Jason Green Newsgroups: comp.os.msdos.djgpp Subject: Re: problem using "templates" Date: Sat, 01 Jan 2000 11:59:43 +0000 Organization: Customer of Planet Online Lines: 41 Message-ID: References: NNTP-Posting-Host: modem-76.palladium.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news6.svr.pol.co.uk 946728100 15792 62.136.22.204 (1 Jan 2000 12:01:40 GMT) NNTP-Posting-Date: 1 Jan 2000 12:01:40 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Agent 1.7/32.534 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com alainm AT news DOT mcgill DOT ca (Alain Magloire) wrote: > Think, Eli's right , this compile and run fine with my version of gcc : On which platform? > % cat z.cc > #include > > template class my_class { > public : > static char* str; > }; > > template char* my_class::str="abc"; > > int main() > { > cerr << my_class::str << endl; > } > % make z > g++ z.cc -o z > % ./z > abc > % gcc --version > 2.95.1 Can you try: g++ --version, to be sure? The same code fails here: D:\>gpp z.cc -o z d:/djgpp/tmp\ccohGsqu.o(.text+0x12):z.cc: undefined reference to `my_class::str' collect2: ld returned 1 exit status D:\>gpp --version 2.951 Doesn't automatically follow that it is a compiler bug though, it depends on whether the source code is actually legal.