From: Jason Green Newsgroups: comp.os.msdos.djgpp Subject: Re: problem using "templates" Date: Mon, 03 Jan 2000 17:14:35 +0000 Organization: Customer of Planet Online Lines: 57 Message-ID: References: <386E51DC DOT 7577C2ED AT is DOT elta DOT co DOT il> NNTP-Posting-Host: modem-56.present.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 946919938 2269 62.136.134.56 (3 Jan 2000 17:18:58 GMT) NNTP-Posting-Date: 3 Jan 2000 17:18:58 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 Eli Zaretskii wrote: > > On which platform? > > It doesn't matter. The problem happens during compilation, and refers > only to the C++ libraries. There's nothing platform-specific in these > two areas, AFAIK. Eli, there is something not quite right here. The following code compiles fine in Linux but under DJGPP it fails to link: /* test.cpp */ #include template class foo { public : static int bar; }; template int foo::bar = 123; int main() { int i; i = foo::bar; cout << "i=" << i << endl; } In Linux: $ g++ --version 2.95.2 $ g++ -Wall test.cpp -o test $ ./test i=123 In Dos/Windows: D:\>gpp --version 2.952 D:\>gpp -Wall test.cpp -o test d:/djgpp/tmp\ccuAyWLk.o(.text+0xb):test.cpp: undefined reference to `foo::bar' collect2: ld returned 1 exit status I just can't see how this program can compile with g++ on one platform but not under DJGPP using the same gcc version. And I don't see how the C++ libraries could be involved? Also I noticed that the version numbers are quoted slightly differently (2.95.2 vs 2.952) which seemed strange.