# Std::vector - unresolved while linking

**URL:** <https://root-forum.cern.ch/t/std-vector-unresolved-while-linking/31955>\
**Category:** ROOT\
**Created:** [December 11, 2018, 7:40am UTC](https://root-forum.cern.ch/t/std-vector-unresolved-while-linking/31955 "2018-12-11T07:40:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saesaj](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/4af34b/32.png) [@saesaj](https://root-forum.cern.ch/u/saesaj)\
**Post date:** [December 11, 2018, 7:40am UTC](https://root-forum.cern.ch/t/std-vector-unresolved-while-linking/31955/1 "2018-12-11T07:40:14Z")

</div>

Hello,  
I am trying to work with std::vector in a ROOT macro.  
The first time, I run the code, it runs without problem. The second time, it gives me the following error and does not run. I have to restart root and then it works well again.

> IncrementalExecutor::executeFunction: symbol ‘_ZSt4moveIN9\_\_gnu\_cxx17\_\_normal\_iteratorIPdSt6vectorIdSaIdEEEES6\_ET0\_T\_S8\_S7_’ unresolved while linking [cling interface function]!  
> You are probably missing the definition of \_\_gnu\_cxx::\_\_normal\_iterator\<double\*, std::vector\<double, std::allocator \> \> std::move\<\_\_gnu\_cxx::\_\_normal\_iterator\<double\*, std::vector\<double, std::allocator \> \>, \_\_gnu\_cxx::\_\_normal\_iterator\<double\*, std::vector\<double, std::allocator \> \> \>(\_\_gnu\_cxx::\_\_normal\_iterator\<double\*, std::vector\<double, std::allocator \> \>, \_\_gnu\_cxx::\_\_normal\_iterator\<double\*, std::vector\<double, std::allocator \> \>, \_\_gnu\_cxx::\_\_normal\_iterator\<double\*, std::vector\<double, std::allocator \> \>)  
> Maybe you need to load the corresponding shared library?

Am I doing something wrong or is there a problem with my compilation or version of ROOT? Is there a solution to this problem?

I did try the solution given in this thread: [Symbol ... unresolved while linking](https://root-forum.cern.ch/t/symbol-unresolved-while-linking/28915) , but the problem remained as it is.

I am also copying a simple code which reproduces the problem.

> //R\_\_LOAD\_LIBRARY(libTreePlayer)  
> #include   
> void sub\_vector\_simple() {  
> //create vector  
> std::vector \<Double\_t\> myVec;  
> //Add components  
> for (Int\_t i=0;i\<10;i++) {  
> myVec.push\_back(i+1000);  
> }  
> //erase 4-7  
> myVec.erase(myVec.begin()+4,myVec.begin()+7);  
> //print  
> for(Double\_t dd : myVec)  
> {  
> cout\<\<dd\<\<" "\<\<endl;;  
> }  
> }

* * *

_ROOT Version:_ 6.15/01  
_Platform:_ Kubuntu 16.04  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [December 17, 2018, 12:31pm UTC](https://root-forum.cern.ch/t/std-vector-unresolved-while-linking/31955/2 "2018-12-17T12:31:34Z")

</div>

Hi @saesaj

Apologies for the delay, I just tried and I cannot reproduce:

```cpp
root [0] .L sub_vector_simple.C
root [1] sub_vector_simple()
1000 
1001 
1002 
1003 
1007 
1008 
1009 
root [2] sub_vector_simple()
1000 
1001 
1002 
1003 
1007 
1008 
1009 

```

It might be a problem with your installation of ROOT. When you say it fails in the second run, you ran the macro twice in the same way I did?

Enric

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [December 17, 2018, 4:40pm UTC](https://root-forum.cern.ch/t/std-vector-unresolved-while-linking/31955/3 "2018-12-17T16:40:56Z")

</div>

We have known issues with reloading of code; this is certainly one of them. Your most stable option is to quit ROOT and restart - and believe me, I know just how terrible this is ☹ I really hope we will be able to tackle this in 2019…

---

<div class="post-metadata">

**Author:** ![saesaj](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/4af34b/32.png) [@saesaj](https://root-forum.cern.ch/u/saesaj)\
**Post date:** [December 17, 2018, 4:56pm UTC](https://root-forum.cern.ch/t/std-vector-unresolved-while-linking/31955/4 "2018-12-17T16:56:30Z")

</div>

Hi Enric and Axel,  
Thank you very much for your replies.

**Axel** , thank you for letting me know. Right now, I am doing what you said, quitting and restarting. It is a bit annoying, but certainly manageable. I wanted to be certain it wasn’t something I was doing wrong.

**Enric** , if I run it the way you do, it does not pose problem. It fails when I run `.x sub_vector_simple.C` twice in a row. Or else it fails if I make a change to the macro, load it again and then try to run it.

```auto
root [0] .L sub_vector_simple.C
root [1] sub_vector_simple()
1000 
1001 
1002 
1003 
1007 
1008 
1009 
root [2] .L sub_vector_simple.C
root [3] sub_vector_simple()
IncrementalExecutor::executeFunction: symbol '_ZSt4moveIN9 __gnu_cxx17__ normal_iteratorIPdSt6vectorIdSaIdEEEES6_ET0_T_S8_S7_' unresolved while linking [cling interface function]!
You are probably missing the definition of __gnu_cxx::__ normal_iterator<double*, std::vector<double, std::allocator<double> > > std::move< __gnu_cxx::__ normal_iterator<double*, std::vector<double, std::allocator<double> > >, __gnu_cxx::__ normal_iterator<double*, std::vector<double, std::allocator<double> > > >( __gnu_cxx::__ normal_iterator<double*, std::vector<double, std::allocator<double> > >, __gnu_cxx::__ normal_iterator<double*, std::vector<double, std::allocator<double> > >, __gnu_cxx::__ normal_iterator<double*, std::vector<double, std::allocator<double> > >)
Maybe you need to load the corresponding shared library?
root [4] 

```

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [December 31, 2018, 4:56pm UTC](https://root-forum.cern.ch/t/std-vector-unresolved-while-linking/31955/5 "2018-12-31T16:56:33Z")

</div>

Closed on December 31, 2018, 4:56pm UTC

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