Hi,
I’m attempting to generate a ROOT dictionary with some code that uses namespaces.
My header is basically like this:
namespace event {
class Event: public TObject {
// ....
ClassDef(Event, 1);
};
}
The header seems to be processed fine, but I get an issue with the corresponding source file:
#include "Event/Event.h"
namespace event {
ClassImp(Event)
}
I get this error message:
[1151 $] make install
[ 1%] Building CXX object Event/CMakeFiles/Event.dir/src/Event.cxx.o
In file included from /nfs/slac/g/ldmx/software/root/root-6.06.08-build/include/TObject.h:31:0,
from /u/ey/jeremym/ldmx-dev/ldmx-sw/Event/include/Event/Event.h:5,
from /u/ey/jeremym/ldmx-dev/ldmx-sw/Event/src/Event.cxx:1:
/nfs/slac/g/ldmx/software/root/root-6.06.08-build/include/Rtypes.h:272:7: error: ‘TGenericClassInfo’ does not name a type
TGenericClassInfo *GenerateInitInstance(const name*); \
^
/nfs/slac/g/ldmx/software/root/root-6.06.08-build/include/Rtypes.h:279:24: note: in expansion of macro ‘ClassImpUnique’
#define ClassImp(name) ClassImpUnique(name,default)
^
/u/ey/jeremym/ldmx-dev/ldmx-sw/Event/src/Event.cxx:7:1: note: in expansion of macro ‘ClassImp’
ClassImp(Event)
^
/nfs/slac/g/ldmx/software/root/root-6.06.08-build/include/Rtypes.h:275:44: error: ‘GenerateInitInstance’ was not declared in this scope
GenerateInitInstance((name*)0x0)->SetImplFile(__FILE__, __LINE__); \
^
/nfs/slac/g/ldmx/software/root/root-6.06.08-build/include/Rtypes.h:279:24: note: in expansion of macro ‘ClassImpUnique’
#define ClassImp(name) ClassImpUnique(name,default)
^
/u/ey/jeremym/ldmx-dev/ldmx-sw/Event/src/Event.cxx:7:1: note: in expansion of macro ‘ClassImp’
ClassImp(Event)
^
make[2]: *** [Event/CMakeFiles/Event.dir/src/Event.cxx.o] Error 1
make[1]: *** [Event/CMakeFiles/Event.dir/all] Error 2
make: *** [all] Error 2
I am using the following CMake to do this:
ROOT_GENERATE_DICTIONARY(EventDict ${Event_INCLUDE_DIR}/Event/Event.h MODULE ${PROJECT_NAME} LINKDEF ${Event_INCLUDE_DIR}/Event/EventLinkDef.h)
And I have this link def:
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ nestedclass;
#pragma link C++ nestedtypedef;
#pragma link C++ namespace event;
#pragma link C++ defined_in namespace event;
#pragma link C++ class event::Event+;
#endif
It seems quite similar to this old thread pertaining to ROOT5.
[url]Trying to compile rootcint dictionary with namespaces
Am I missing something simple here that is causing this to fail?
Also, is there an example of creating a ROOT dictionary using namespaces someplace? This seems like it would be very handy.
Thanks!
–Jeremy