Vector<float> problems in root

Here is my small macro that gives a terrible error when I try to run it:



void testing(vector theFloats) {
cout << “hello” << endl;

void testing() {
vector filterEffeciency;
filterEffeciency.push_back( 1.0 );
filterEffeciency.push_back( 1.0 );

And this is when I try to run it from the command line:

$ root -l -b -q "testing.C()"
TDR Style initialized
root [0]
Processing testing.C()…
Error: Can’t call vector<float,allocator >::vector<float,allocator >((class vector)137732928) in current scope testing.C:3:
Possible candidates are…
(in vector<float,allocator >)
/afs/ -1:-1 0 public: vector<float,allocator > vector<float,allocator >::vector<float,allocator >(void);
/afs/ -1:-1 0 public: vector<float,allocator > vector<float,allocator >::vector<float,allocator >(vector<float,allocator >::size_type n,const float& value=float());
/afs/ -1:-1 0 public: vector<float,allocator > vector<float,allocator >::vector<float,allocator >(const vector<float,allocator >& x);
/afs/ -1:-1 0 public: vector<float,allocator > vector<float,allocator >::vector<float,allocator >(vector<float,allocator >::const_iterator first,vector<float,allocator >::const_iterator last);
*** Interpreter error recovered ***

Any ideas what is going wrong?

Dear mbanderson,

I have unsuccessfully tried to reproduce your problem using exactly the same distribution as you from out 32-bit test machine:

One potential difference is the way you set the ROOT environment (here done by the ‘source’ line): can you check that?

G. Ganis

the problem I had above may or may not be related to a bug I had found a different point in time that may be fixed by now.

"c++ vector scope issue?" … m_id=48289


In the original problem it looks like the dictionary for vector was not automatically loaded (by the #include ) as it should have. It could have been a flaw either in the ROOT code or in your build of the source.

Either way a good work-around is to simply use:root -l -b -q "testing.C+()"