Hi Paul, Your problem is probably that you are using a static library. When using a shared library, the dictionary is automatically loaded. On the other hand when using a static library you have to force the linking of the dictionary. For this you have 3 methods: - add the dictionary object file to the link line - Explicitly ask for a symbol from the dictionary on the link line -uXXXX - add to the main and/or a function that is for sure linked in a reference to something in the dictionary file. Cheers, Philippe. -----Original Message----- From: Paul Balm [mailto:r45@nikhef.nl] Sent: Monday, July 07, 2003 2:43 AM To: Philippe Canal Cc: p.balm@nikhef.nl; roottalk@pcroot.cern.ch Subject: Re: [ROOT] filling tree with objects Hi Philippe, I think now my dictionary generation actually did succeed: I see messages like "generating rootcint dictionary" and "compiling dictionary" etc., and they're not followed by errors. But when I run my program I have a new problem: Error in <BuildRealData>: Can not find any ShowMembers function for recocert::V0! It seems that the ShowMembers method was generated correctly and included in my library too: diemen-clued0:/work/diemen-clued0/balm/recocert/p1403 >nm lib/Linux2.4-KCC_4_0/librecocert.a | grep ShowMembers U ShowMembers__7TCanvasFR16TMemberInspectorPc 00000628 t GenericShowMembers__4ROOTFPCcPvR16TMemberInspectorPcb 00000c50 t GetShowMembersWrapper__6TClassFv U ShowMembers__7TObjectFR16TMemberInspectorPc 000003bc T ShowMembers__Q2_8recocert2V0FR16TMemberInspectorPc Do you know what may be the problem here? Thanks- Paul Philippe Canal wrote: Hi Paul, I am surprised that your dictionary generation succeeded. I would expect that you need to have (in that order): class V0 : public TObject { (...) ClassDef(V0,1); }; .... #ifdef __MAKECINT__ #pragma link C++ namespace recocert; #pragma link C++ class recocert::V0+; #endif __AND__ have either an empty linkdef file or at least a linkdef file with NO 'pragma link off' Cheers, Philippe. -----Original Message----- From: Paul Balm [mailto:r45@nikhef.nl] Sent: Thursday, July 03, 2003 10:42 AM To: Philippe Canal Cc: roottalk@pcroot.cern.ch Subject: Re: [ROOT] filling tree with objects Hi Philippe, In the header file that defines the V0 class, I (now) have: #pragma link C++ namespace recocert; #pragma link C++ class recocert::V0+; and later on: class V0 : public TObject { (...) }; When I run the program, it says: Error in <TTree::Bronch>: Cannot find class:recocert::V0 So I think the answer to your question is yes, but... Thanks- Paul Philippe Canal wrote: Hi Paul, This should work. Did you create a dictionary for the namespace recocert? #pragma link C++ namespace recocert; Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Paul Balm Sent: Wednesday, July 02, 2003 8:07 AM To: roottalk@pcroot.cern.ch Subject: [ROOT] filling tree with objects Hello, I'm trying to fill a TTree with objects of a class "V0", declared in a namespace "recocert". I do this: TTree* _mytree = new TTree("V0tree","secondary vertices"); V0* _myV0 = new V0(); _mytree->Branch("V0s", "recocert::V0",&_myV0); This gives me an error message: Error in <TTree::Bronch>: Cannot find class:recocert::V0 At first I was creating the branch like this: _mytree->Branch("V0s", "V0",&_myV0); (i.e. omitting the "recocert::"), this gave me the same error message, but, without "recocert::". In the same file where I create the tree and the branch, I have "using namespace recocert;" Any idea what the problem is here? Is this just not supported? Are there ways to work around it? I'm using this root version: /D0/ups/root/Linux-2-4/v3_05_00bKCC_4_0-exception-opt-thread On Red Hat 7.1. Thanks! Paul
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET