ld problem with templates

Wei Ku weiku@UTKUX1.UTK.EDU
Wed Jul 9 17:14:00 GMT 1997


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@utkux.utcc.utk.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@solid.ssd.ornl.gov
***************************************


 
 ----
From: Sylvio Triebel <Sylvio.Triebel@inf-technik.tu-ilmenau.de>
To: gnu-win32@cygnus.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
--

--------------------------------------------------------------------
|######........|                         
|                           
|
|######........| 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@inf-technik.tu-ilmenau.de             
|
|...........##.|                                                     
|
--------------------------------------------------------------------
-
For help on using this list (especially unsubscribing), send a message to
" gnu-win32-request@cygnus.com " 
with one line of text: "help".





More information about the Cygwin mailing list