Multiple definitions in STL on win32
Mumit Khan
khan@NanoTech.Wisc.EDU
Wed Mar 15 20:56:00 GMT 2000
On 13 Mar 2000, Marat Boshernitsan wrote:
>
> I am getting a multiple definition problem compiling a program that uses
> STL 3 with Cygwin GCC 2.95.2, binutils 2.9.4 under Win2K. Compiling the
> exact same program on Linux and Solaris with GCC 2.95.2 yields no
> errors. In some cases, adding -O1 to the compilation fixes the error,
> and in some cases it does not. Is this a known problem? Is there a
> workaround? (The exact errors are at the end of this message). Looking
> at nm output, it seems that gcc doesn't mark symbols weak when it
> should...
x86-win32 gcc uses what's called "unique" sections, not weak symbols for
this type of code, and template instantiations are emitted in unique
sections which are then handled by the linker. If you look at the symbols,
you'll see those pesky .data$* and .text$* section symbols.
You may want to try a pre-release version of the compiler and linker
that will be distributed with the next Cygwin release. See:
ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin/snapshots/gcc-2.95.2-1/
Can you provide me with a testcase?
Regards,
Mumit
More information about the Gcc
mailing list