delorie.com/archives/browse.cgi | search |
From: | Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk> |
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: | <vvvvvvllpmiltbb6v30q4reahtjflvet77@4ax.com> |
References: | <Pine DOT SUN DOT 3 DOT 91 DOT 991230155042 DOT 1790D-100000 AT is> <viRa4.6159$36 DOT 52788 AT carnaval DOT risq DOT qc DOT ca> |
NNTP-Posting-Host: | modem-76.palladium.dialup.pol.co.uk |
Mime-Version: | 1.0 |
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 <iostream.h> > > template <class ccc> class my_class { > public : > static char* str; > }; > > template <class ccc> char* my_class<ccc>::str="abc"; > > int main() > { > cerr << my_class<int>::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<int>::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.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |