ACLiC problem

I am using root version 5.22/0 on Vista. I have a class that inherits from TObject. The .h file contains#if !defined(__CINT__) || defined(__MAKECINT__) ClassDef(CScopeHeader,1) #endif and the .cpp file contains#if !defined(__CINT__) || defined(__MAKECINT__) ClassImp(CScopeHeader) #endif I have written my own Streamer for the class. I can build a .DLL using this class with a linkdef.h file containing the line#pragma link C++ class CScopeHeader-; and everything works just fine. However, if I try to use ACLiC[quote].L ScopeHeader.cpp+[/quote]I get the following error[quote]root [12] .L CScopeHeader.cpp+
Info in TWinNTSystem::ACLiC: creating shared library c:\Analysis01\CScopeHeader_cpp.dll
c:\Analysis01\CScopeHeader_cpp_ACLiC_dict.cxx(107) : error C2084: function ‘void CScopeHeader::Streamer(TBuffer &)’ alre
ady has a body
c:\analysis01\CScopeHeader.h(38) : see previous definition of 'Streamer’
Error in : Compilation failed![/quote]Is there a way to work around this problem? Is there some way to let ACLiC know that there is already a Streamer()? Thanks


Hi Ed,

You need to make sure that ACLiC sees the line:#pragma link C++ class CScopeHeader-; which you can do by either putting it inside your header file or within a file named ScopeHeader_linkdef.h


Still unsing root 5.22/0 on Vista. Another problem that appears to be aclic related. I have a class that has members that are of type MATCHSTRUCT defined by a typedef that I would like to include within the class definition section of the .h file:private: typedef struct{ char cat; char nhits; short x; short y; . . } MATCHSTRUCT . . . MATCHSTRUCT *fMatch; When I try to compile from the commandline with.L CThreeHit.cpp+I get all these errors:[quote]Info in TWinNTSystem::ACLiC: creating shared library c:\Analysis01\CThreeHit_cpp.dll
c:\Analysis01\CThreeHit_cpp_ACLiC_dict.cxx(75) : error C2371: ‘ROOT::Shadow::CThreeHit::MATCHSTRUCT’ : redefinition; dif
ferent basic types
c:\Analysis01\CThreeHit_cpp_ACLiC_dict.cxx(43) : see declaration of ‘ROOT::Shadow::CThreeHit::MATCHSTRUCT’

Error in : Compilation failed![/quote]However, if I put the typedef OUTSIDE the class definition, it compiles and runs fine. However, since the struct is only used within the class, I would prefer to hide it there… I have tried including a CThreeHit_linkdef.h - makes not difference.

Finally,when I include the .h and .cpp as part of a Visual Studio 2008 .DLL project, it compiles and runs just fine regardless of where the typedefs are located (inside the class definition or outside)

Any help would be much appreciated. Thanks

Hi Ed,

Why using a C syntax inside a C++ class :slight_smile: ? Can you try:private: struct MATCHSTRUCT { char cat; char nhits; short x; short y; . . }; ...


To answer your question - ignorance! This fixes my - many thanks!