Home | News | Documentation | Download

Compile error with TVector3


I want to use a TVector3 in my Garfield++ code, but it gives me a following compile error, and I don’t know where exactly my problem comes from.

Undefined symbols for architecture x86_64:
“vtable for TVector3”, referenced from:
TVector3::TVector3() in full_tpc_sim.C.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
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]: *** [full_tpc_sim] Error 1
make[1]: *** [CMakeFiles/full_tpc_sim.dir/all] Error 2
make: *** [all] Error 2

Now I have a few basic questions:

  1. I can run example codes such as AliceTPC etc. Perhaps, I get the same error when I try to use TVector3 in the AliceTPC code.
    Do I need a different makefile when I want to use a specific ROOT class in the Garfield++ code?
  2. When I did a quick search of an alternative makefile, I saw a line “LIBDIR = $(GARFIELD_HOME)/Library” in the file. Where I installed Garfield++, I don’t have a Library directory, but I see these: libGarfield.dylib, libGarfieldDict.rootmap, libGarfieldDict_rdict.pcm. Did I install Garfiled++ correctly? or missing something else?
    I use: ROOT Version: 6.18/04, cmake version 3.16.2, gcc 4.2.1
    Any advice/suggestions would be greatly appreciated.
    Thank you in advance for your help.

Kind Regards,

you need to make small modification to the CMakeLists.txt for your application, replacing the line

target_link_libraries(full_tpc_sim Garfield)


target_link_libraries(full_tpc_sim Garfield ROOT::Physics)

Regarding your second question: the makefile you found with the line LIBDIR = $(GARFIELD_HOME)/Library is a deprecated one, it won’t work with the CMake build of Garfield++.

Thank you for your quick reply! I really appreciate it.
If I also want to use TTree, TH1F, TH2F, would it require an additional change in CMakeLists.txt?

Kind Regards,

Yes, for TTree you need to add ROOT::Tree to the target_link_libraries command.

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