# Unresolved symbol while linking error upon second run of macro

**URL:** <https://root-forum.cern.ch/t/unresolved-symbol-while-linking-error-upon-second-run-of-macro/39175>\
**Category:** Newbie\
**Created:** [April 29, 2020, 8:01pm UTC](https://root-forum.cern.ch/t/unresolved-symbol-while-linking-error-upon-second-run-of-macro/39175 "2020-04-29T20:01:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charlie\_Chen](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/charlie_chen/32/21807_2.png) [@Charlie\_Chen](https://root-forum.cern.ch/u/Charlie_Chen)\
**Post date:** [April 29, 2020, 8:01pm UTC](https://root-forum.cern.ch/t/unresolved-symbol-while-linking-error-upon-second-run-of-macro/39175/1 "2020-04-29T20:01:23Z")

</div>

Hello,

I’m trying to run a very simple test script for working with vectors on ROOT6.18/00:

```auto
#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](https://root-forum.cern.ch/t/std-vector-unresolved-while-linking/31955). 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

* * *

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 29, 2020, 8:02pm UTC](https://root-forum.cern.ch/t/unresolved-symbol-while-linking-error-upon-second-run-of-macro/39175/2 "2020-04-29T20:02:58Z")

</div>

You probably need at least ROOT 6.20/00 (in previous ROOT 6 versions, macro unloading / reloading was not working / not supported).

Note: in any version, if you do not need to modify your macro, you can use:

```nohighlight
root [0] .x test.C
root [1] test();

```

---

<div class="post-metadata">

**Author:** ![Charlie\_Chen](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/charlie_chen/32/21807_2.png) [@Charlie\_Chen](https://root-forum.cern.ch/u/Charlie_Chen)\
**Post date:** [April 29, 2020, 8:04pm UTC](https://root-forum.cern.ch/t/unresolved-symbol-while-linking-error-upon-second-run-of-macro/39175/3 "2020-04-29T20:04:26Z")

</div>

Apologies, I made a mistake in my original post about the version of root, it should instead read 6.18/00, I realize that it is still not 6.18/04, but I just wanted to make you aware that I was not using a 6.14 release.

EDIT: Wile, I tried your suggestion I still get the error after .x test.C but I get the correct output upon running test(). Thanks.
