From: weiku AT UTKUX1 DOT UTK DOT EDU ("Wei Ku") Subject: Re: ld problem with templates 9 Jul 1997 19:08:41 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199707091951.PAA28150.cygnus.gnu-win32@solid.ssd.ornl.gov> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01BC8C7F.C92AECA0" X-Mailer: Microsoft Outlook Express 4.71.0544.0 Original-To: X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE Engine V4.71.0544.0 Original-Sender: owner-gnu-win32 AT cygnus DOT com This is a multi-part message in MIME format. ------=_NextPart_000_01BC8C7F.C92AECA0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable I have not tried the stl yet but I will try. My suggestion is to use g++ = instead of gcc. With g++, the libraries you used (lstdc++, g++) are = linked by default, so you do not need to use option '-l' to link them. I = hope this can solve your 'multiple definition' problem. eg, tye the = following simple command: g++ -c xx.cc g++ -o xx.exe xx.o ... Sincerely, Wei Ku *************************************** Department of Physics and Astronomy The University of Tennessee 1408 Circle Drive Knoxville, Tennessee 37996-1200 weiku AT utkux DOT utcc DOT utk DOT edu --------------------------------------- Solid State Division Oak Ridge National Laboratory P.O.Box 2008 Oak Ridge, TN 37831-6032 Phone: (423) 574-5795 Fax: (423) 574-4143 weiku AT solid DOT ssd DOT ornl DOT gov *************************************** ---- From: Sylvio Triebel To: gnu-win32 AT cygnus DOT com Date: Wednesday, July 09, 1997 3:13 PM Subject: ld problem with templates dear sirs, I tried to compile a program that uses stl extensivly. There is no problem to compile it with gnu 2.7.2 under solaris, linux and OS/2. Using gnuwin32 causes hundreds of linker errors like this: .... multiple definition of __default_alloc_template::... (all errors occured contain '__default_alloc_template::' !) Is it a known problem? Should I use other ld options? options to compile cc files were : gcc -c xx.cc options to link the executable were : gcc -o xx.exe xx.o ... -lstdc++ -lg++ -lm thanks S. Triebel -- -------------------------------------------------------------------- |######........| | | |######........| Sylvio Triebel | Tel.: +49 (0)3677 69 1171 | |..##..........| TU Ilmenau | oder 69 1168 | |..##.##.##....| PSF 327, 98693 Ilmenau | FAX : +49 (0)3677 69 1163 | |.....##.##....| | | |.....#####.##.|-----------------------------------------------------| |.....#####.##.| | |...........##.| E-Mail: silvio AT inf-technik DOT tu-ilmenau DOT de | |...........##.| | -------------------------------------------------------------------- - 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". ------=_NextPart_000_01BC8C7F.C92AECA0 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

I have not tried the stl = yet but I will=20 try. My suggestion is to use g++ instead of gcc. With g++, the libraries = you=20 used (lstdc++, g++) are linked by default, so you do not need to use = option '-l'=20 to link them. I hope this can solve your 'multiple definition' problem. = eg, tye=20 the following simple command:

g++ -c xx.cc

g++ -o xx.exe xx.o ...

Sincerely,
Wei Ku

***************************************
Department of Physics and Astronomy
The University of Tennessee
1408 Circle Drive
Knoxville, Tennessee 37996-1200
weiku AT utkux DOT utcc DOT utk DOT edu
= ---------------------------------------
Solid State Division
Oak Ridge National Laboratory
P.O.Box 2008
Oak Ridge, TN 37831-6032
Phone: (423) 574-5795
Fax: (423) 574-4143
weiku AT solid DOT ssd DOT ornl DOT gov
= ***************************************

 

----
From: Sylvio Triebel = <Sylvio DOT Triebel AT inf-technik DOT tu-ilmenau DOT de>
To: gnu-win32 AT cygnus DOT com
Date: Wednesday, July 09, 1997 3:13 PM
Subject: ld problem with templates

dear sirs,
I tried to compile a program that uses stl extensivly.
There is no problem to compile it with  gnu 2.7.2 under solaris, = linux
and OS/2.
Using gnuwin32 causes hundreds of linker errors like this:
.... multiple definition of = __default_alloc_template<false,0>::...

(all errors occured contain '__default_alloc_template<false,0>::' = !)

Is it a known problem? Should I use other ld options?

options to compile cc files were :
gcc -c xx.cc

options to link the executable were :
gcc -o xx.exe xx.o ... -lstdc++ -lg++ -lm


thanks
S. Triebel
--

--------------------------------------------------------------------
|######........|         &nb= sp;           &nbs= p;  =20 |            =             &= nbsp; =20 |
|######........| Sylvio=20 Triebel          | Tel.: = +49=20 (0)3677 69 1171 |
|..##..........| TU=20 Ilmenau           =   =20 |            =  =20 oder 69 1168 |
|..##.##.##....| PSF 327, 98693 Ilmenau  | FAX : +49 (0)3677 69 = 1163 |
|.....##.##....|         &nb= sp;           &nbs= p;  =20 |            =             &= nbsp; =20 |
|.....#####.##.|-----------------------------------------------------| |.....#####.##.|         &nb= sp;           &nbs= p;            = ;            =       =20 |
|...........##.| E-Mail: silvio AT inf-technik DOT tu-il= menau.de          &= nbsp;=20 |
|...........##.|         &nb= sp;           &nbs= p;            = ;            =       =20 |
--------------------------------------------------------------------
-
For help on using this list (especially unsubscribing), send a message = to
"gnu-win32-request AT cygnus DOT com= "=20 with one line of text: "help".
------=_NextPart_000_01BC8C7F.C92AECA0-- - 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".