Dear ROOTers,
I am trying to compile my ROOT code, unsuccessfully.
Unfortunately I’m getting a strange error message when executing the Makefile.
Please find everything below!
Simplified code to describe my problem - h1draw.C:
#include "TROOT.h"
#include "TSystem.h"
#include "TString.h"
#include "TFile.h"
int main()
{
TString rootfile = TString("/path/to/test.root");
TFile *tf = TFile::Open(rootfile.Data(), "RECREATE");
}
Makefile to compile the latter code example:
CC=g++
CFLAGS= -g -Wall
ROOTInc = -I$(ROOTSYS)/include \
ROOTLibs = -L$(ROOTSYS)/lib \
-lAfterImage -lASImageGui -lASImage \
-lCore -lCint -lCintex -lNew -lGed -lGeomPainter -lGeom -lGpad \
-lGui -lGuiBld -lGX11 -lGX11TTF -lfreetype -lGraf -lGraf3d -lHist -lHistPainter \
-lMatrix -lMinuit -lPostscript -lTree -lTreePlayer -lTreeViewer \
-lRint -lRGL -lSPlot -lX3d -lEG \
-lRooFit -lRooFitCore \
h1draw: h1draw.C
$(CC) $(CFLAGS) $(ROOTInc) $(ROOTLibs) h1draw.C -o h1draw
Executing the above mentioned Makefile gives the following output:
make
g++ -g -Wall -I/Users/fat/root/include -L/Users/fat/root/lib -lAfterImage -lASImageGui -lASImage -lCore -lCint -lCintex -lNew -lGed -lGeomPainter -lGeom -lGpad -lGui -lGuiBld -lGX11 -lGX11TTF -lfreetype -lGraf -lGraf3d -lHist -lHistPainter -lMatrix -lMinuit -lPostscript -lTree -lTreePlayer -lTreeViewer -lRint -lRGL -lSPlot -lX3d -lEG -lRooFit -lRooFitCore h1draw.C -o h1draw
h1draw.C: In function ‘int main()’:
h1draw.C:25: warning: unused variable ‘tf’
Undefined symbols:
"TFile::Open(char const*, char const*, char const*, int, int)", referenced from:
_main in ccVFwSVy.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [h1draw] Error 1
Maybe you have an idea why this happens?! What could be wrong?
Many thanks in advance!
flo