TTree problem in using Garfield++

In the official example of Garfield++, I can not initialize a pointer of TTree.There will be an error in the making process.
But other parts like TCanvas 、TROOT 、TApplication of ROOT can work well.

Undefined symbols for architecture x86_64:
  "TTree::TTree(char const*, char const*, int, TDirectory*)", referenced from:
      _main in mdt.C.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [mdt] Error 1

Above is the output message in my MacOS. In fact, I also tested it in Ubuntu 18, almost the same problem happened.

You need to make a small modification to the CMakeLists.txt of your application, changing

target_link_libraries(mdt Garfield::Garfield)


target_link_libraries(mdt Garfield::Garfield ROOT::Tree)

Thanks a lot!
It did solve my problem!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.