Hello,
I’m trying to run a very simple test script for working with vectors on ROOT6.18/00:
#include "TFile.h"
#include "TTree.h"
#include "TTreeReader.h"
#include "TTreeReaderValue.h"
#include <iostream>
#include <vector>
using namespace std;
vector<float> compute_a1();
void test(){
vector<float> coeffs;
coeffs.clear();
coeffs = compute_a1();
cout << coeffs.size() + 5 << endl;
}
vector<float> compute_a1(){
vector<float> coeffs;
coeffs.push_back(1.0);
coeffs.push_back(2.0);
coeffs.push_back(3.0);
return coeffs;
}
When running using ‘.x test.C’ it runs fine the first time but running again using the same command throws the following linking error:
IncrementalExecutor::executeFunction: symbol ‘ZSt15__alloc_on_moveISaIfEEvRT_S2’ unresolved while linking [cling interface function]!
You are probably missing the definition of void std::__alloc_on_move<std::allocator >(std::allocator&, std::allocator&)
Maybe you need to load the corresponding shared library?
I’ve tried searching for this error and the closest topic that I found is this one: Std::vector - unresolved while linking. I’ve tried some of the solutions mentioned in this thread (including compiling using .L test.C and running test(), but this throws the same error as above if I change the file). I could restart root everytime I need to run but I foresee that this will get extremely tedious for future code debugging especially when I need to run the code multiple times so I was just wondering if there was an alternate solution, or if I will have to resort to restarting root.
Thanks for the help,
Charlie
_ROOT Version: 6.18/00
_Platform: Scientific Linux release 6.10 (Carbon)
_Compiler: GCC 8.3.0