Message: Re: error in steppingaction and main Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: error in steppingaction and main 

Forum: Event and Track Management
Re: Question error in steppingaction and main (kunli)
Date: 15 May, 2014
From: Gumplinger Peter <Gumplinger Peter>

The compiler tells you exactly what's wrong:

> error: no matching function for call to &#65533;SteppingAction::SteppingAction()&#65533;
>      runManager->SetUserAction(new SteppingAction);
>                                    ^
> SteppingAction.hh:26:3: note:   candidate expects 2 arguments, 0 provided

> Part of my code:
> int main(int argc, char* argv[]){
> runManager->SetUserAction(new SteppingAction);

> SteppingAction.hh
> class SteppingAction: public G4UserSteppingAction{
> public:
>   SteppingAction(DetectorConstruction*, EventAction*);

In your class definition you define the constructor with two argument, yet in your main you want to construct it without an argument.

This is a dumb C++ error. Try to think a little (or learn C++) next time you come across another compiler error.

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Ok: Re: error in steppingaction and main   (kunli - 16 May, 2014)
 Add Message Add Message
to: "Re: error in steppingaction and main"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]