Re: Troubles with ClassDef and ClassImp

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Wed, 11 May 2011 11:40:15 +0200


Hi Salvador,

You need to create a dictionary for your header. See e.g. <http://root.cern.ch/drupal/content/how-generate-dictionary>

Cheers, Axel.

Salvador Marti wrote on 05/11/2011 11:36 AM:
> Hi
>
> I am trying to save my class in a TFile. I have read the documentation
> and I learned that I need to use the ClassDef and ClassImp in my .h and
> .C files. So far so good.
>
> The trouble is that when I include those lines in my code, then I get an
> error when I compile my files. I even tried in a simple test file and
> I've got exactly the same error.
>
> Well, I compile the code within root with the .x MyTest.C++ command
>
> The .h and .C files are attached.
>
> Thanks for your help. Salva
>
> ------- These is the error message --------------
> root [0] .x MyTest.C++
> Info in <TUnixSystem::ACLiC>: creating shared library
> /Users/smarti/scratch/RootTest/./MyTest_C.so
> dlopen error: dlopen(/Users/smarti/scratch/RootTest/./MyTest_C.so, 10):
> Symbol not found: __ZN7MyClass11ShowMembersER16TMemberInspector
> Referenced from: /Users/smarti/scratch/RootTest/./MyTest_C.so
> Expected in: flat namespace
> in /Users/smarti/scratch/RootTest/./MyTest_C.so
> Load Error: Failed to load Dynamic link library
> /Users/smarti/scratch/RootTest/./MyTest_C.so
> Undefined symbols:
> "MyClass::ShowMembers(TMemberInspector&)", referenced from:
> vtable for MyClassin MyTest_C_ACLiC_dict.o
> "_main", referenced from:
> start in crt1.10.6.o
> "MyClass::Class()", referenced from:
> MyClass::IsA() constin MyTest_C_ACLiC_dict.o
> "MyClass::Streamer(TBuffer&)", referenced from:
> vtable for MyClassin MyTest_C_ACLiC_dict.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
>
Received on Wed May 11 2011 - 11:40:20 CEST

This archive was generated by hypermail 2.2.0 : Wed May 11 2011 - 17:50:01 CEST