_ROOT Version: 6.30/06
Built for linuxx8664gcc on Apr 03 2024, 10:34:21
From tags/v6.30.06@v6.30.06
_Platform: Ubuntu 20.04.6 LTS
_Compiler:g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
I am trying to compile my code read_root_file.cpp
using the command
g++ `root-config --cflags --libs` -o read_root_file read_root_file.cpp
However, I’m getting
/usr/bin/ld: /scratch/login/cc1xfIL7.o: in function `main': read_root_file.cpp:(.text+0xc6): undefined reference to `TFile::Open(char const*, char const*, char const*, int, int)' /usr/bin/ld: read_root_file.cpp:(.text+0x1f3): undefined reference to `TTree::Class()' /usr/bin/ld: /scratch/login/cc1xfIL7.o: in function `__static_initialization_and_destruction_0(int, int)': read_root_file.cpp:(.text+0x521): undefined reference to `TVersionCheck::TVersionCheck(int)' /usr/bin/ld: /scratch/login/cc1xfIL7.o: in function `TIter::TIter(TCollection const*, bool)': read_root_file.cpp:(.text._ZN5TIterC2EPK11TCollectionb[_ZN5TIterC5EPK11TCollectionb]+0x1c): undefined reference to `vtable for TIter' /usr/bin/ld: /scratch/login/cc1xfIL7.o: in function `TIter::~TIter()': read_root_file.cpp:(.text._ZN5TIterD2Ev[_ZN5TIterD5Ev]+0x13): undefined reference to `vtable for TIter' collect2: error: ld returned 1 exit status
My .bashrc has this
export ROOTSYS=/home/dkennedy_umass_edu/root
export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH
export LD_LIBRARY_PATH=$ROOTSYS/lib:$PYTHONDIR/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$ROOTSYS/lib
and just running this
root-config --cflags --libs
gives me
-pthread -std=c++17 -m64 -I/home/dkennedy_umass_edu/root/include -L/home/dkennedy_umass_edu/root/lib -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -Wl,-rpath,/home/dkennedy_umass_edu/root/lib -pthread -lm -ldl -rdynamic
If anyone can help point out what PATH I’m missing or messing up or if its a different issue, that would be much appreciated!
Thanks,
Dyson!