You are here

How can I fix the problem leading to :Error: Can't call vector<...>::push_back

I am defining a vector for my custom type (for example Track) in a root macro but when I push_back a Track object in the vector, CINT complains. e.g.
vector testVector;
Track obj;
Error: Can't call vector::push_back(timeStamp) in current scope MyAnalysisMasterTreeMaker.C:358:
Possible candidates are...
(in vector)
*** Interpreter error recovered ***
Although, if I use a vector or vector or vector push_back works fine.

This usually indicates that some classes dictionary refer and/or use this particular instance of std::vector.

To solve the problem, you will need to generate a dictionary for this particular instance. With ROOT v5.27/06 and above this can be done by executing:
With older version of ROOT ; this can simply be done using ACLiC and a simple loader.C script:
// File loader.C
#ifdef __MAKECINT__
#pragma link C++ class vector<Track>+;