Dear Root users,
I used TTree and TFile in my files, but I always had trouble to compile them. I simplifed my files to several lines which reproduce the errors when I tried to compile my original files. Could you please tell me what is wrong with my file? I am running my files at a Linux Red Hat Enterprise 3 with Intel cpu.
I attached my file and my Makefile is following:
CC = /usr/bin/g++
cc = /usr/bin/gcc
ROOTSYS = /usr/local/root
ROOTINC = (ROOTSYS)/include ROOTLIB = (ROOTSYS)/lib
tryfile: tryfile.o
{CC} -o tryfile tryfile.o -L{ROOTLIB}
tryfile.o: tryfile.cpp
(CC) -I(ROOTINC) -c tryfile.cpp
The errors I got:
/usr/bin/g++ -I/usr/local/root/include -c tryfile.cpp
/usr/bin/g++ -o tryfile tryfile.o -L/usr/local/root/lib
tryfile.o(.text+0x2d): In function tree_init()': : undefined reference to
TTree::TTree(char const*, char const*, int)’
tryfile.o(.text+0x58): In function tree_init()': : undefined reference to
TObject::operator delete(void*)’
tryfile.o(.text+0x7d): In function tree_init()': : undefined reference to
TObject::operator delete(void*)’
tryfile.o(.text+0x13e): In function main': : undefined reference to
TFile::TFile(char const*, char const*, char const*, int)’
tryfile.o(.text+0x17e): In function main': : undefined reference to
TObject::operator delete(void*)’
tryfile.o(.text+0x1b2): In function main': : undefined reference to
TObject::operator delete(void*)’
tryfile.o(.gnu.linkonce.t._ZN7TObjectnwEj+0xd): In function TObject::operator new(unsigned int)': : undefined reference to
TStorage::ObjectAlloc(unsigned int)’
collect2: ld returned 1 exit status
make: *** [tryfile] Error 1
Thank you very much!
Best,
Jing
tryfile.cpp (1.04 KB)