Closed thnam closed 10 years ago
Hi Nam, are you sure you are working on master? and did you call "cmake ." to update Makefile? I tried to compile on my desktop and IHEP server and it worked for both cases.
Yes, I tried and failed on Mac & Linux, geant4.10.0.p2 and geant4.10.0.00 I even installed another geant4 by install-geant4.sh, but the error is still the same:
Scanning dependencies of target g4simlib
[ 1%] Building CXX object CMakeFiles/g4simlib.dir/home/nam/work/g4sim/src/MyStepLimiter.cc.o
/home/nam/work/g4sim/src/MyStepLimiter.cc: In member function ‘virtual void MyStepLimiter::ConstructProcess()’:
/home/nam/work/g4sim/src/MyStepLimiter.cc:42: error: ‘theParticleIterator’ was not declared in this scope
/home/nam/work/g4sim/src/MyStepLimiter.cc:39: warning: unused variable ‘ph’
/home/nam/work/g4sim/geant4-install/include/Geant4/CLHEP/Units/PhysicalConstants.h: At global scope:
/home/nam/work/g4sim/geant4-install/include/Geant4/CLHEP/Units/PhysicalConstants.h:79: warning: ‘CLHEP::electron_charge’ defined but not used
/home/nam/work/g4sim/geant4-install/include/Geant4/CLHEP/Random/Randomize.h:61: warning: ‘CLHEP::HepRandomGenActive’ defined but not used
make[2]: *** [CMakeFiles/g4simlib.dir/home/nam/work/g4sim/src/MyStepLimiter.cc.o] Error 1
make[1]: *** [CMakeFiles/g4simlib.dir/all] Error 2
make: *** [all] Error 2
So I've just deleted my intermediate CMake files in cmake/ and tried recompiling and I get the same error as Nam. I will look into it.
I know that between Geant4 v9 and v10 the class G4VPhysicsConstructor
stopped defining the protected field theParticleIterator
so that you now need to define this object yourself in derived classes. If you guys only just upgraded to v10 then perhaps this is why you're now seeing this issue?
Yes, it could be. I'm searching through the Geant4 code on LXR site and it seems to have a lot of:
#ifdef theParticleIterator
#undef theParticleIterator
#endif
But I think I've found the class it's supposed to be:
G4ParticleTable::G4PTblDicIterator* theParticleIterator
= G4ParticleTable::GetParticleTable()->GetIterator();
but now I'm getting linker errors...
Ok, so the linking error was because SLC5 is still on gcc4.1 and I hadn't exported the environment variables for my copy of gcc 4.7.
However, now the executable seems to be being put in g4sim/cmake/bin
rather than g4sim/bin
. I guess this is from when I messed around with the environment scripts yesterday so I will look into it.
And the odd location for the executable was because SLC has an old version of CMake and I hadn't added my updated version...
OK, once I've checked that g4sim works as expected I will commit and push the correction.
Thanks to Andy! This solved the problem nicely. An interesting found: they turned to use "aParticleIterator" instead of "theParticleIterator" in G4.10
Compiling failed with this error message:
I suppose it relates to the stuff Chen just removed.