Re: [ROOT] Error: multiple definitions

From: cstrato (cstrato@aon.at)
Date: Mon Dec 15 2003 - 17:10:40 MET


Dear Eddie

Thank you, this solved my problem.

BTW, I got you message twice, but it did not make
it to the roottalk archive.

Best regards
Christian

Edmond Offermann wrote:
> Dear Christian,
> 
> Declaration of your variable is supposed to
> happen once . So leave in your header file
> the statement
>  " const char *kXPSName = "This is text"; " .
> 
> In the other source files where you want to have
> access to this variable put
> 
>   extern const char *kXPSName;
> 
> Actually it is a better strategy to have in your
> header file the extern statement and in
> one source file the declaration statement.
> 
> Eddy
> 
> ps. let's see if my mail makes it past the spam
> filters on roottalk :-)
> 
> --- cstrato <cstrato@aon.at> wrote:
> 
>>Dear Rooters
>>
>>In the header file XPSApp.h I have defined:
>>    const char *kXPSName = "This is text";
>>//or:   static const char *kXPSName = "This is
>>text";
>>
>>In a couple of source files I "#include XPSApp.h"
>>Sorrowly, at the end of the compilation I get the
>>error:
>>
>>ld: multiple definitions of symbol _kXPSName
>>XDataFrame.o definition of _kXPSName in section
>>(__DATA,__data)
>>XPSApp.o definition of _kXPSName in section
>>(__DATA,__data)
>>make: *** [XPSApp] Error 1
>>
>>Do you know how I can define kXPSName so that I can
>>use
>>it in multiple source files?
>>
>>Thank you in advance
>>Best regards
>>Christian
>>_._._._._._._._._._._._._._._._
>>C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
>>V.i.e.n.n.a       A.u.s.t.r.i.a
>>_._._._._._._._._._._._._._._._
>>
> 
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET