Hi, I’m using Garfield++ to get a plot of the electric field inside a drift chamber. Garfield++ call some ROOT graphic libraries to do that, and I receive the following errors when I try to compile:
/home/roberto/garfield/Library/libGarfield.a(ViewField.o): In function `Garfield::ViewField::CreateFunctionWeightingField()':
ViewField.cc:(.text+0x32e9): undefined reference to `gROOT'
ViewField.cc:(.text+0x3786): undefined reference to `TF1::CreateFromFunctor(char const*, int)'
/home/roberto/garfield/Library/libGarfield.a(ViewField.o): In function `Garfield::ViewField::CreateProfileFunction()':
ViewField.cc:(.text+0x4859): undefined reference to `gROOT'
ViewField.cc:(.text+0x4ca9): undefined reference to `TF1::CreateFromFunctor(char const*, int)'
/home/roberto/garfield/Library/libGarfield.a(ViewField.o): In function `Garfield::ViewField::CreateFunction()':
ViewField.cc:(.text+0x59c9): undefined reference to `gROOT'
ViewField.cc:(.text+0x5e66): undefined reference to `TF1::CreateFromFunctor(char const*, int)'
/home/roberto/garfield/Library/libGarfield.a(ViewMedium.o): In function `Garfield::ViewMedium::AddFunction(double, double, double, double, bool, std::string, std::string, int, char, double, double, double)':
ViewMedium.cc:(.text+0x13a3): undefined reference to `gROOT'
ViewMedium.cc:(.text+0x18aa): undefined reference to `TF1::CreateFromFunctor(char const*, int)'
collect2: error: ld returned 1 exit status
make: *** [gasfile] Error 1
I think that the compiler can’t find the library TF1.h that is a ROOT’s graphic library, but I linked ROOT’s libraries in the makefile.
This is my makefile:
Maybe you could post the full output of the linking step (i.e. including the line “$(CXX) $(CFLAGS) -o gasfile2 gasfile2.o $(LDFLAGS)”) and the output of:
root-config --cxx
root-config --cflags
root-config --glibs
Maybe you could also try to replace all root-config --... with $(shell root-config --…)
Are you sure that your Garfield++ library has been compiled with the same ROOT version that you try to use now?
I actually suspect that your Garfield++ library has been compiled with ROOT 5.x and you try to use it now with ROOT 6.x.