Define a flag to during the run

Read the error message out loud to yourself. Which line number of the file is it on? What exactly is it telling you is wrong? Look specifically at the line number in the error message, then look at the same line number in your code.

If you want to be able to write your own software, and understand how it works, then you need to be able to do it yourself, identify problems and fix them yourself. The problem you are having has nothing to do with Geant4. It is basic C++ programming.

@mkelsey Yes I read the wrong line and what it is telling that it’s wrong…but I can’t understand the reason…
I mean
this is the wrong line theSteppingAction->SetRootFlag(StoB(newValues)); and it says that there is a not thefined type “SteppingAction”

but it is defined in my SteppingActionMessenger.hh

No, it is NOT “defined in my SteppingActionMessenger.hh”. It is declared in that .hh file (look up "forward declaration in C++). All you’ve done there is told the compiler that a class with that name exists, but haven’t told it how the class is structured.

In your file, you appear to have

#include "B1SteppingAction.hh"

Is that the header file where you defined your SteppingAction class? If so, what is the name of the class you assigned in that file? You should be using the same class name for the SteppingAction in your Messenger.

Thank you @mkelsey. In these days I installed Qt as you can red here so I didn’t have Geant4. Moreover, now I’ve to do something more important (the flag is just a fuction that my supervisor wants, but it isnt’ important for the analysis, because I can just comment the lines for the moment).
I will try again the flag next days and I will update this topic