G4IonTable produces compilation error

Hi,

I have moved to Geant 10.7.p03. I was working previously in 10.4.1. The code was compiling previously when using Geant 10.4.1.

There is any update I need to introduce to the code?

Here is the compilation error

[ 94%] Building CXX object source/packages/restG4/CMakeFiles/restG4.dir/src/PhysicsList.cxx.o
/Users/javi/rest-framework/source/packages/restG4/src/PhysicsList.cxx:263:58: error: incomplete type 'G4IonTable' named in nested name specifier
                if (restPhysList->GetIonStepList()[n] == G4IonTable::GetIonTable()->GetIonName(Z, A)) {
                                                         ^~~~~~~~~~~~
/Users/javi/geant4.10.07.p03/install/include/Geant4/G4ParticleTable.hh:57:7: note: forward declaration of 'G4IonTable'
class G4IonTable;

Thanks!

The error message implies that you’re missing the line

#include "G4IonTable.hh"

in your PhysicsList.cxx file. If this is true, then your code would not have compiled successfully with any G4 10.x version.

1 Like

Yes, you are right about your first statement. But not in the conditional, this is probably due to the fact that G4IonTable.hh might have been removed from any other header we use inside PhysicsList.cxx file in newer Geant4 versions.

Our pipeline is building with Geant 4.10.2 but not with 10.7

Line 129

Ah, yes. You’re right. It’s a good rule of thumb to always #include classes that you access directly in the .cc/.cxx file, rather than relying on some other .hh file providing for you behind the scenes.

Right, but usually I add the headers once a compilation error arises, probably not the only one :sweat_smile: This time I didnt think about that because it was compiling with previous versions.

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