G4Allocator in Custom Hit Class


I am trying to finish writing a hit class that gathers information from stepping action on location of interaction energy and particle momentum, however I have defined a memory allocation object with parameters
extern G4ThreadLocal however it is not being found in my sensitive detector class resulting in a subsequent compilation error of “undefined reference to (myObject)”.

Any ideas on how to address this problem would be very much appreciated.

You have to have the statement “extern G4Threadlocal x” in global scope (i.e., at the top) of all files that use it, except in one file you leave out the word “extern” so that it has an actual place in memory.