Symbol(s) not found on TFile::Open

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:


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:

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!

you’re missing at least “-lRIO” among your “ROOTLibs”. 8-[
Instead of hard-coding the list of ROOT specific entries, in your “Makefile”, use something like: :-({|=

ROOTInc = (shell root-config --cflags) ROOTLibs = (shell root-config --glibs)

Type “root-config” in your shell prompt in order to get its short “usage” help.
Type “man root-config” in order to get its manpage (if you have it properly installed) or try to have a look at this:

I am stupid. No?
Pepe Le Pew.

yeah thanks a lot…RIO… was missing!

have a nice weekend,