Hi, I’m having problems reading a class that contains a vector of vectors of a class that contains a vector of ints (and before you ask, yes I think this is the best solution though I could be wrong).
Everything seems to work beautifully with the MSVC compiled code, reads and writes without any problems; however, when I try to read the created root file in a macro I get the following error (many times):
Error in TBuffer::ReadVersion: Could not find the StreamerInfo with a checksum of ### for the class “vector” in Vehicle.root.
I’m attaching a simplified set of files:
Table (cpp & h) - a simple class with a single vector member.
Vehicle (cpp & h) - the container class that contains a vector<vector
>.
main.cpp - the code that creates and later reads the tree.
tree.C - the macro I’m using to read the tree.
…and some supporting files:
CompileCodes.cpp - a root macro I’m using to create my dlls
I’ve tried writing a custom streamer, but I had the same errors.
Humm … this is odd I am unable to reproduce your problem.
More surprisingly your example seems incomplete since I get (when executing tree.C): Error: Can't call vector<vector<Table,allocator<Table> >,allocator<vector<Table,allocator<Table> > > >::size() in current scope tree.C:32:
This is easily solve by adding to Vehicle.cpp:#ifdef __MAKECINT__
#pragma link C++ class vector<Table>;
#pragma link C++ class vector<vector<Table> >;
#endif(and then I also need to make sure the dict for vector is loaded by doing #include on the command line).
Then I get:[code]bash-3.2$ root.exe -b -
root [0] #include <vect
root [1] .x tree.C
number of cars: 2
Vehicle[0]:parameter=1
vector[0][0][0]=1111
vector[0][0][1]=1112
vector[0][0][2]=1113
vector[0][1][0]=1121
vector[0][1][1]=1122
vector[0][1][2]=1123
vector[0][2][0]=1131
vector[0][2][1]=1132
vector[0][2][2]=1133
vector[1][0][0]=1211
vector[1][0][1]=1212
vector[1][0][2]=1213
vector[1][1][0]=1221
vector[1][1][1]=1222
vector[1][1][2]=1223
vector[1][2][0]=1231
vector[1][2][1]=1232
vector[1][2][2]=1233
vector[2][0][0]=1311
vector[2][0][1]=1312
vector[2][0][2]=1313
vector[2][1][0]=1321
vector[2][1][1]=1322
vector[2][1][2]=1323
vector[2][2][0]=1331
vector[2][2][1]=1332
vector[2][2][2]=1333
In using 2 different build system you inadvertently used 2 version of the ROOT I/O:rootcint -f TableDict.cpp -c Table.hwill request to use the old I/O for the Table class, while the compilation via ACLiC will request to use the new I/O. Because the old I/O is not self describing, we can’t know when looking at a file where it is compatible with the new I/O. Most time it is, sometimes it is not. In particular the support for stl container was inadequate in the old I/O.
So in you compile script you need to request the new I/O for your classes, either adding a trailing ‘+’ at the end of the #pragma link line or in your example simply use:rootcint -f TableDict.cpp -c Table.h+