Hi everyone!
I just finished writing my first actual script, but when I’m trying to run it in ROOT with " .x read_to_vectors.C " I get this message:
IncrementalExecutor::executeFunction: symbol ‘_Z15read_to_vectorsv’ unresolved while linking [cling interface function]!
You are probably missing the definition of read_to_vectors()
Maybe you need to load the corresponding shared library?
Ubuntu: 18.04
gcc : 7.3.0
Since this is my very first script I don’t really know if I made a terrible mistake or if it’s my system’s fault. Could someone please give me a hint ?
P.S. this forum has been a great help ! Thank you all very much!!
read_to_vectors.C
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include "TGraph.h"
#include "TFile.h"
using namespace std;
void read_to_vectors();
int main()
{
vector<float> vecCounts, vecTime, veccps;
float counts, time;
Int_t dim =32;
ifstream inputFile("data12.txt");
while (inputFile >> time >>counts)
{
vecTime.push_back(time);
vecCounts.push_back(counts);
}
for (int i(0); i< vecCounts.size(); i++)
{
veccps.push_back(vecCounts[i]/60);
vecTime[i]=vecTime[i]+0.5;
cout << vecTime[i] << " " <<veccps[i] << endl;
}
TFile *file = new TFile("Graph1.root","RECREATE");
TGraph *gr1 = new TGraph (dim , &vecCounts[0], &vecTime[0]);
gr1->Draw("A*");
return 0;
}
Ilias