I’m trying to reproduce the results with ROOT6 on a local computer, but I am not getting the behavior I should when I’m executing the program, instead I get the following error at compile time:
/tmp/cc0WJDZJ.o: In function `main':
/home/juan/Desktop/Work/test/2Dhist.cpp:36: undefined reference to `TCanvas::TCanvas(char const*, char const*, int, int)'
/home/juan/Desktop/Work/test/2Dhist.cpp:39: undefined reference to `TChain::TChain(char const*, char const*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:44: undefined reference to `TH2F::TH2F(char const*, char const*, int, double, double, int, double, double)'
/home/juan/Desktop/Work/test/2Dhist.cpp:57: undefined reference to `TPolyLine::TPolyLine(int, double*, double*, char const*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:58: undefined reference to `TPolyLine::TPolyLine(int, double*, double*, char const*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:59: undefined reference to `TPolyLine::TPolyLine(int, double*, double*, char const*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:62: undefined reference to `TCutG::TCutG(char const*, int, double const*, double const*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:63: undefined reference to `TCutG::TCutG(char const*, int, double const*, double const*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:64: undefined reference to `TCutG::TCutG(char const*, int, double const*, double const*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:119: undefined reference to `gStyle'
/home/juan/Desktop/Work/test/2Dhist.cpp:119: undefined reference to `TStyle::SetOptStat(int)'
/home/juan/Desktop/Work/test/2Dhist.cpp:36: undefined reference to `TObject::operator delete(void*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:39: undefined reference to `TObject::operator delete(void*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:44: undefined reference to `TObject::operator delete(void*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:57: undefined reference to `TObject::operator delete(void*)'
/home/juan/Desktop/Work/test/2Dhist.cpp:58: undefined reference to `TObject::operator delete(void*)'
/tmp/cc0WJDZJ.o:/home/juan/Desktop/Work/test/2Dhist.cpp:59: more undefined references to `TObject::operator delete(void*)' follow
/tmp/cc0WJDZJ.o: In function `__static_initialization_and_destruction_0(int, int)':
/home/juan/root/include/TVersionCheck.h:31: undefined reference to `TVersionCheck::TVersionCheck(int)'
/tmp/cc0WJDZJ.o: In function `TObject::operator new(unsigned long)':
/home/juan/root/include/TObject.h:152: undefined reference to `TStorage::ObjectAlloc(unsigned long)'
/tmp/cc0WJDZJ.o: In function `TAxis::CenterTitle(bool)':
/home/juan/root/include/TAxis.h:186: undefined reference to `TObject::SetBit(unsigned int, bool)'
collect2: error: ld returned 1 exit status
Which is weird, because it seems that I didn’t install ROOT6 properly since the compiler doesn’t recognize the class calls.
I installed ROOT6.22 by the followig sequence of commands in my Ubuntu 18.04 LTS machine:
$ wget https://root.cern/download/root_v6.22.00.Linux-ubuntu18-x86_64-gcc7.5.tar.gz
$ tar -xzvf root_v6.22.00.Linux-ubuntu18-x86_64-gcc7.5.tar.gz
$ source root/bin/thisroot.sh
These are the instructions that appeared on the website for installing ROOT6 on Ubuntu. I also added the source command to my .bashrc. I also installed all the required packages for running ROOT6 on Ubuntu. I ran the interpreter and it works just fine as well. Is there something else I’m missing from the installation process?