# Symbol ... unresolved while linking

**URL:** <https://root-forum.cern.ch/t/symbol-unresolved-while-linking/28915>\
**Category:** ROOT\
**Created:** [May 4, 2018, 1:58pm UTC](https://root-forum.cern.ch/t/symbol-unresolved-while-linking/28915 "2018-05-04T13:58:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [May 4, 2018, 1:58pm UTC](https://root-forum.cern.ch/t/symbol-unresolved-while-linking/28915/1 "2018-05-04T13:58:17Z")

</div>

Hi,

I try to run this small macro in ROOT 6.10/04 on lxplus:

```auto
void analysis()
{
        const char* myFileName = (char*)"/eos/atlas/atlascerngroupdisk/det-trt-tb/testbeam2017/TimePix/Analysis/run18/Analysis/Run18_analysis_18.root";

        TH2F *h_TrPhotonEnergyVsAngle = new TH2F("h_TrPhotonEnergyVsAngle", "TR photons energy vs. angle;#theta [mrad];Energy [keV];Number of photons", 200, 0., 4., 200, 0., 40.);
        TH1F *h_TrPhotonAngle_allEnergies = new TH1F("h_TrPhotonAngle_allEnergies", "TR photons angle;#theta [mrad];Number of TR photons", 200, 0., 4.);

        const char runNumber_1stDigit = myFileName[strlen(myFileName)-7];
        const char runNumber_2ndDigit = myFileName[strlen(myFileName)-6];
        const int runNumber = (runNumber_1stDigit - '0')*10 + (runNumber_2ndDigit - '0');

        bool isElectronRun, isMuonRun, isCalibrationRun;
        isElectronRun = isMuonRun = isCalibrationRun = false;

        if ((18 <= runNumber && runNumber <= 36) || (50 <= runNumber && runNumber <= 53) || runNumber == 76 || runNumber == 77 || runNumber == 81)
        {
                isElectronRun = true;
        }
        else if ((54 <= runNumber && runNumber <= 74) || (78 <= runNumber && runNumber <= 80))
                isMuonRun = true;
        else if (runNumber == 49)
                isCalibrationRun = true;
        else
        {
                printf("Unable to associate this run #%i with any series, exiting now...\n", runNumber);
                return;
        }

        TFile *input = TFile::Open(myFileName, "READ");

        if (!input)
        {
                printf("FAILED\n");
                return;
        }
        else
                printf("OK\n");

        std::vector<double> photonsEnergies;

        TTreeReader myReader((char*)"goodEventData", input);

        TTreeReaderValue<Int_t> NTrPhotonsInEvent(myReader, "eventGammaN");
        TTreeReaderArray<Double_t> photonEnergy(myReader, "gammaE");

        while (myReader.Next())
        {
                for (Int_t gammaIt = 0; gammaIt < photonEnergy.GetSize(); gammaIt++)//iterates over all photons in this event
                        photonsEnergies.push_back(photonEnergy[gammaIt]);
        }

        input->Close();
        return;
}

```

simply typing

```auto
root -l -q analysis.c

```

, but it fails with the following:

```auto
Processing analysis.c...
IncrementalExecutor::executeFunction: symbol '_ZN4ROOT8Internal20TTreeReaderValueBase18GetElementTypeNameB5cxx11ERKSt9type_info' unresolved while linking [cling interface function]!
You are probably missing the definition of ROOT::Internal::TTreeReaderValueBase::GetElementTypeName[abi:cxx11](std::type_info const&)
Maybe you need to load the corresponding shared library?

```

Any ideas why?

The weird thing is that if I replace

```auto
        std::vector<double> photonsEnergies;

```

with

```auto
        std::vector<int> photonsEnergies;

```

, it works fine (but I really want the vector to be the vector of doubles). Or, if I keep the vector of doubles and I comment out the initialization of the first histogram, the `h_TrPhotonEnergyVsAngle`, it also works fine. Finally, if I comment out the

```auto
        else
        {
                printf("Unable to associate this run #%i with any series, exiting now...\n", runNumber);
                return;
        }

```

block, it also starts to run. So I’m a bit puzzled here… Are these things even connected?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 7, 2018, 8:25am UTC](https://root-forum.cern.ch/t/symbol-unresolved-while-linking/28915/2 "2018-05-07T08:25:08Z")

</div>

Maybe @Axel could help on this…

---

<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:** [May 7, 2018, 8:39am UTC](https://root-forum.cern.ch/t/symbol-unresolved-while-linking/28915/3 "2018-05-07T08:39:46Z")

</div>

Hi,

Please add  
`R__LOAD_LIBRARY(libTreePlayer)`  
at the beginning of your script, before or after the `#include`s.

(This is fixed in the current master, soon-to-be 6.14.)

Axel.

---

<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:** [May 21, 2018, 8:40am UTC](https://root-forum.cern.ch/t/symbol-unresolved-while-linking/28915/4 "2018-05-21T08:40:59Z")

</div>

Closed on May 21, 2018, 8:40am UTC

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