Hi Marc,
when creating a dictionary for a class we assume that you pass the header file containing the class to rootcint. This works nicely e.g. for CircuitInfo where CircuitInfo.cpp includes the header (the class definition, that is) for CircuitInfo.
For vector that's different, of course; you cannot just pass "vector" to rootcint. The easiest way is to create a dummy header which you pass to rootcint and that gets then included in the dictionary:
inclvector.h:
#include <vector>
rootcint –f dict.cxx –c Id.cpp CircuitInfo.cpp inclvector.h WeightedLinkDef.h
By the way: usually it's sufficient to pass the header files to rootcint (unless you define your classes in the sources). And the LinkDef's file name must end on "LinkDef.h" or it will be treated as a regular header.
Cheers, Axel.
On 2008-10-20 12:27, Marc de Kamps wrote:
>
>
> Hi,
>
>
>
> I’m trying to read and write several objects of my own classes from and
> to disk.
>
> This works well with the LinkDef.h below, except for one thing.
>
>
>
> If I do
>
>
>
> rootcint –f dict.cxx –c Id.cpp CircuitInfo.cpp WeightedLink.h
>
>
>
> a dict.cxx is generated without a problem. It does not compile however.
> In dict.h
>
> the following line is present:
>
>
>
> typedef vector<CircuitInfo,allocator<CircuitInfo> >
> G__vectorlECircuitInfocOallocatorlECircuitInfogRsPgR;
>
>
>
> which generates an error message. If I add:
>
>
>
> #include <vector>
>
>
>
> at the beginning of dict.h, the file compiles and the resulting program
> behaves correctly. It is as if I need to tell rootcint somehow that
>
> #include <vector> must be generated in dict.h. How do I achieve this?
>
>
>
> I use root 5.17/04 on windows.
>
>
>
> Marc
>
>
>
> #ifdef __CINT__
>
> #include <vector>
>
>
>
> #pragma link C++ class Id+;
>
> #pragma link C++ class CircuitInfo+;
>
> #pragma link C++ class WeightedLink<double>+;
>
> #pragma link C++ class std::vector<CircuitInfo>+;
>
>
>
> -
>
> Dr. Marc de Kamps
>
> Biosystems Group
>
> School of Computing
>
> University of Leeds
>
> LS29JT, Leeds, UK
>
>
>
> dekamps_at_comp.leeds.ac.uk <mailto:dekamps_at_comp.leeds.ac.uk>
>
> http:/www.comp.leeds.ac.uk/dekamps
>
>
>
Received on Mon Oct 20 2008 - 12:47:00 CEST
This archive was generated by hypermail 2.2.0 : Mon Oct 20 2008 - 17:50:02 CEST