Error in b1runaction.cc file of example B1

Hello experts,
I have used General Particle Source in exampleB1. But i faces error in B1RunAction.cc file (shown in image of terminal)
what should change i do in B1RunAction.cc file. Please help.
B1RunAction.cc (5.8 KB)

Thank You!


You don’t show your actual code, so we have to guess from the errors. I presume that when you say “I have used General Particle Source in exampleB1,” you mean that you replaced the #include "G4ParticleGun.hh" with #include "G4GeneralParticleSource.hh". Your errors show clearly that you didn’t change instances in the code where G4ParticleGun* was used to make use of G4GeneralParticleSource* instead. And you probably didn’t change the return type of your GeneratorAction::GetParticleGun() either.

Your code needs to be self-consistent if you expect it to compile.

1 Like

Thank you. From where i can learn how to use general particle source?

This isn’t about “how to use GeneralParticleSource.” This is basic C++ programming. I suggest you read up on writing code in C++, how to use header files, how to declare variables, etc. C++ is a strongly typed language, and requires all objects and variables to be explicitly declared with a type.

1 Like