From: "Tanes Sriviroolchai" Newsgroups: comp.os.msdos.djgpp Subject: Different behavior of gcc in DJGPP from other systems Date: Fri, 19 Jan 2001 10:50:26 +0700 Lines: 56 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Original-NNTP-Posting-Host: 192.127.136.173 Message-ID: <3a67b9a4$1@rpc1284.daytonoh.ncr.com> X-Original-Trace: 18 Jan 2001 22:51:00 -0500, 192.127.136.173 NNTP-Posting-Host: ncrnews.daytonoh.ncr.com X-Trace: 19 Jan 2001 11:32:49 -0500, ncrnews.daytonoh.ncr.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi, I'm not sure about the error I get. During manage STLport4.0 to be compiled with DJGPP, I found an error of template instantiation that can be decribed by the following short program: #include #include namespace myname { union _D_rep { unsigned short rep[4]; double val; }; template class _LimG { public: static const _D_rep _D_inf; }; template const _D_rep _LimG<__dummy>::_D_inf = {{0,0,0x7ff0,0}}; }; main() { cout << myname::_LimG::_D_inf.val; return 0; } when compile by gcc -ftemplate-depth-32 -c a.cc and link by gcc -o a.exe a.o -lstdcxx I get link error as shown below: a.o(.text+0xb):a.cc: undefined reference to `myname::_LimG::_D_inf collect2: ld returned 1 exit status I use gcc 2.95.2, djdev 2.03. This short program can be compiled and linked successfully with the same options in other systems of gcc 2.95.2 such as Linux, FreeBSD, SysV. This short program can be compiled successfully on DJGPP also if I specify -frepo during compile. This could leads to a problem while moving some codes into library. Could someone please tell me the reason. Regards, Tanes Sriviroolchai