delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/20/21:54:07

From: Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk>
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
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 <string>
> 
> struct foo : public std::string_char_traits<char>
> {
> };
> 
> typedef basic_string<char, struct foo > CIString;
> 
> int main(void)
> {
>  CIString foo;
>  foo = "temp";
>  return 0;
> }
> ---------------
> 
> The error:
> 
> tempprob.o: In function `basic_string<char,
> foo,__default_alloc_template<false, 0> >::basic_string(void)':
> tempprob.cpp:1: undefined reference to `basic_string<char,
> foo,__default_alloc_template<false, 0> >::nilRep'
> make.exe: *** [tempprob.exe] Error 1

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019