[ROOT] rootcint, templates and multiply defined symbols

From: David Morrison (dave@bnl.gov)
Date: Tue Aug 20 2002 - 17:42:44 MEST


Hi,

I've attached a tar file of a trivial project that illustrates a problem 
I'm having with recent versions of ROOT.  I have a couple of classes, 
related by inheritance, with a template involved.  The dictionaries 
generated by rootcint multiply define a global initializer for the base 
class.  This didn't happen with earlier versions of ROOT (3.02/x). 
 Using 3.03/07 I get the following messages when attempting to build the 
attached project:

rootcint -f ADict.C -c A.h ALinkDef.h
Class A<int>: Streamer() not declared
rootcint -f BDict.C -c B.h BLinkDef.h
Class B<int>: Streamer() not declared
Class A<int>: Streamer() not declared
g++ -c ADict.C -I. `root-config --cflags`
g++ -c BDict.C -I. `root-config --cflags`
g++ -shared -o libAB.so ADict.o BDict.o `root-config --libs`
BDict.o: In function `ROOT::GenerateInitInstance(A<int> const *)':
BDict.o(.text+0xd8): multiple definition of 
`ROOT::GenerateInitInstance(A<int> const *)'
ADict.o(.text+0x0): first defined here
BDict.o: In function `ROOT::AlEintgR_IsA(void const *)':
BDict.o(.text+0x17c): multiple definition of `ROOT::AlEintgR_IsA(void 
const *)'
ADict.o(.text+0xa4): first defined here
BDict.o: In function `ROOT::AlEintgR_Dictionary(void)':
BDict.o(.text+0x15c): multiple definition of 
`ROOT::AlEintgR_Dictionary(void)'
ADict.o(.text+0x84): first defined here
collect2: ld returned 1 exit status
make: *** [all] Error 1

I see the following in the development notes:

2002-06-13 18:24  brun

	* utils/src/rootcint.cxx:
	New version  of rootcint from Philippe fixing several problems
	and side-effects of the recent changes by Victor.
	Philippe still working on a problem reported by Mathieu de Naurois
	when using namespaces and templates.
	

which sounds like it might be related to the problem I'm seeing. 
 Assuming this is the case, has there been progress toward any solution? 
  There doesn't seem to be any way to tell rootcint not to generate the 
base class initializer.  Is this the case?

Dave

PS: To try the example, save the attachment and do: uudecode -o - 
g.tar.gz.uu | tar zx ; cd g ; make

-- 
David Morrison  Brookhaven National Laboratory  phone: 631-344-5840
                Physics Department, Bldg 510 C    fax: 631-344-3253
                          Upton, NY 11973-5000  



begin 664 g.tar.gz
M'XL(`,5>8CT``^V736_:0!"&?>W^BFFXM(Z,UU]8@C02)I=(;4_<R6*OG4V,
MC;"I5$7I;\\L$#[R17LPI,H\%PO/.WA7ZW<\D]E&XW#N\S`,\,IYV/%WKBL,
M'@8>]X/0]3MX']4=`X+FEV88\ZH6,P`C$;_D6[I]\?^4S.ZWKQM^!G<X[SPY
M]^WS=USW\?R#T'>UW@WQ_'G#ZUKPP<^_EI-I+FH)9_7OJ2S$1,+PG,6YJ"KH
MLSLVG8]S%7<90/_+5[A3\`UX[QY_LNFLK&5<RT0'AR:H'KOO,<:.O2/B7T#_
M?U?%[85,FRL#^_R_J/E+_W="ST&]$_@.^?\0M%2:R!1&H\'ES^%HQ%AK.A/9
M1$".;P64:0HBSR'+R['(J][+T46UD*]%TWD1UZHL,+XK&)R>PJK0G*FB/K<^
M:X4L$I6";:Z7!*9--:4Q,ON'N)6IRAM\N??YWW><M?^Q`FC_^XY/_C\$Z-`N
M^S0KRSI&#X*50O]"Q75[`%8,V!K"YO.P*XLVL@AET98L0V/K[$?%91NN=*H5
MET6J,K"L.,U%5EVMI='?2JMK,9,)6"66D'$_:E?EZC'EZC_*I_FHPVSL:*0H
M]$XG>O'F'S!1:NI\4^>9'[7$9'9T_/X_\#?]OQ=HO<>I_S\(+57$^3R1<()F
M/V'LK7D@ZL)R',`/-M[<'@XB/1S<K(:#9Z/!S7(T./9>B>>@_]]7_^]ZR_[?
C(_\?@G?1_T?4_Q,$01`$01`$01`$01!$$SP`/-%`?P`H````
`
end



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:05 MET