G4cout is not defined with multithreaded installed

Hi all!

I have installed geant4 with DGEANT4_MULTITHREADED=ON
It works fine in multithreaded mode, but when I try to turn it off with
#undef G4MULTITHREADED
in the beginning of my main file

I get the following error:

CMakeFiles/bin_Lucas.dir/Lucas.cc.o: In function 
`TQGSP_BERT<G4VModularPhysicsList>::SetCuts()':
Lucas.cc: 
(.text._ZN10TQGSP_BERTI21G4VModularPhysicsListE7SetCutsEv[_ZN10TQGSP_B
ERTI21G4VModularPhysicsListE7SetCutsEv]+0xd): undefined reference to `G4cout'
CMakeFiles/bin_Lucas.dir/Lucas.cc.o: In function 
`TQGSP_BERT<G4VModularPhysicsList>::TQGSP_BERT(int)':
Lucas.cc: 
 (.text._ZN10TQGSP_BERTI21G4VModularPhysicsListEC1Ei[_ZN10TQGSP_BERTI21 G4VModularPhysicsListEC1Ei]+0x85): undefined reference to `G4cout'
collect2: error: ld returned 1 exit status

Is this a bug?

cheers

You cannot modify the setup by hacking the code that way… if you need a sequential installation of Geant4, reinstall Geant4 with GEANT4_MULTITHREADED=OFF, or execute your application forcing it to use a single thread (i.e. use the UI command “/run/numberOfThreads 1”).

Hi, you can try as below. If the multi-thread geant4 is install in /home/renqi/Documents/geant4/geant4-MT-install.
rm -rf build
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=/home/renqi/Documents/geant4/geant4-MT-install/lib/Geant4-11.0.2/Geant4Config.cmake …
make