From: Jason Green Newsgroups: comp.os.msdos.djgpp Subject: Re: Linker error using templates Date: Sun, 20 Feb 2000 22:00:41 +0000 Organization: Customer of Planet Online Lines: 41 Message-ID: <1ko0bskqcivkvpk1m6slh4kug7jqfvn3cd@4ax.com> References: <88pi4l$qgl$1 AT nnrp1 DOT deja DOT com> NNTP-Posting-Host: modem-174.potassium.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: newsg4.svr.pol.co.uk 951084565 16758 62.136.18.174 (20 Feb 2000 22:09:25 GMT) NNTP-Posting-Date: 20 Feb 2000 22:09:25 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 bluerv AT my-deja DOT com wrote: > Can someone explain to me what I'm doing wrong here? I don't know what you could be doing wrong (since I don't understand your code ;-) and the command line (or makefile) used to build is missing. A previous problem with undefined references to template objects was resolved by adding the -frepo switch to the compile command line. This is to work around a bug in GCC, not DJGPP. If it is a GCC bug, this should be reported to the GCC maintainers because it is not something that can be fixed in DJGPP. > The code: > --------------- > #include > > struct foo : public std::string_char_traits > { > }; > > typedef basic_string CIString; > > int main(void) > { > CIString foo; > foo = "temp"; > return 0; > } > --------------- > > The error: > > tempprob.o: In function `basic_string foo,__default_alloc_template >::basic_string(void)': > tempprob.cpp:1: undefined reference to `basic_string foo,__default_alloc_template >::nilRep' > make.exe: *** [tempprob.exe] Error 1