"Could not find the StreamerInfo for *old version* of *my class*"

I’m trying to add a new variable to a class that has a custom streamer. So I incremented the ClassDef from 2 to 3 (actually a ClassDefOverride if that makes any difference), and added in the member variable to the header.

I have a little trial function that should write and then read the class to a file.
When I try and run the trial function I get the error;

Error in <TBufferFile::ReadClassBuffer>: Could not find the StreamerInfo for version 2 of the class TFCSParametrizationBinnedChain, object skipped at offset 72
Error in <TBufferFile::CheckByteCount>: object of class TFCSParametrizationBinnedChain read too few bytes: 2 instead of 1229
Error in <TBufferFile::CheckByteCount>: object of class m_input read too few bytes: 3 instead of 66
terminate called after throwing an instance of 'std::length_error'

Which I guess makes sense, since I have just changed the code to represent version 3, so version 2 can’t be found there, and I’m writing a new file, not reading an existing one, so version 2 isn’t going to be there either.

But why does it want to have version 2 anyway? It should be reading and writing version 3.


ROOT Version: 6.24/06
Platform: NAME=“CentOS Linux” VERSION=“7 (Core)” ID_LIKE=“rhel fedora” CLUSTER=“sunrise”
Compiler: using GNU Make 3.82, which presumably calls g++ (GCC) 11.2.0 under the hood.

@pcanal is the expert in that area. I am sure he can help you.

Ah, sorry, I have no idea what I was doing wrong before, but I completely erased the build directory and rebuilt the project, then all errors vanished.
Maybe something needed cmake to be run from scratch, but I should have tried that first.

This is still a bit strange (if the file was containing version 2 of the class layout, it ought to have stored in the file the StreamerInfo for version 2).

To make sure your new code is working properly, I strongly recommend that you also test reading ‘old’ file (that are known to contain version 2 of the class layout).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.