delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/12/09/01:42:08

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: Re: how to avoid mulitple definitions of STL free_list, start_free, end_free,heap_size
9 Dec 1997 01:42:08 -0800 :
Message-ID: <9712090815.AA29183.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <348ABB53 DOT 62AF AT asc DOT on DOT ca>
To: sreuss AT asc DOT on DOT ca
Cc: gnu-win32 AT cygnus DOT com

Stephen Reuss <sreuss AT asc DOT on DOT ca> writes:
> First up, I dealt with the pair structure redeclaration issue by
> renaiming the pair structure in the third party code to mespair.  If
> anyone has ideas of how I can force compiler to choose one declaration
> or another, please let me know.

You can't. No C++ code written in the last 3, especially the last 2, years 
should've used 'struct pair', unless the author(s) was simply hoping that
STL will never make it into the standard ;-)

> 
> The new problem regards the:
>  multiple definition of `__default_alloc_template<false, 0>::start_free
>                                                            ::end_free
>                                                            ::heap_size
>                                                            ::free_list
> 
> in linking a C++ program.  The link command is as follows:
> 

Are you using the b18 C++ compiler? If so, you have other bugs to worry
about as well (miscompiled code when using multiple virtual bases and such
is just one example). If you are, then I strongly suggest you move to a
newer C++ compiler, such as egcs-1.00 or even the newer FSF snapshots.
For a binary distribution of egcs-1.00, check the URL below.

Now that my obligatory plug is out the way, the problem is that the older 
versions of C++ front-end simply couldn't handle static template data 
members properly, and hence the problem. I can suggest a few workarounds:
   
   1. Use -fno-implicit and instantiate everything yourself. I cover a bit
      about explicit instantiation in my (now grossly outdated) STL Newbie
      guide (URL below). This is the only portable (ie., something that'll
      work on *all* platforms) way to do templates with gcc, even with the 
      newest and greatest egcs release.
   2. Comment out the default_alloc_template definition in alloc.h (or
      whatever file it's in in $prefix/include/g++) and supply the
      definition yourself in one of your object files.
   3. Did I mention that you should upgrade your compiler ;-)

EGCS : http://www.xraylith.wisc.edu/~khan/software/gnu-win32/
STL  : http://www.xraylith.wisc.edu/~khan/software/stl/STL.newbie.html

Regards,
Mumit -- khan AT xraylith DOT wisc DOT edu
http://www.xraylith.wisc.edu/~khan/

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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