Message: Weird error when compiling modified N02 Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Weird error when compiling modified N02 

Forum: Documentation and Examples
Date: 04 Jun, 2007
From: Adam <ax_blais@laurentian.ca>

I've been modifying ExN02 for a while now and it has been working fine.
I changed a variable declaration and got this error when compiling:

Compiling ExN02EventAction.cc ...
In file included from include/ExN02RunAction.hh:37,
                 from src/ExN02EventAction.cc:34:
/usr/local/geant4/geant4.8.2/source/run/include/G4UserRunAction.hh:34:
 error: expected constructor, destructor, or type conversion before 
"class"
/usr/local/geant4/geant4.8.2/source/run/include/G4UserRunAction.hh:59: 
error: ISO C++ forbids declaration of `G4Run' with no type
/usr/local/geant4/geant4.8.2/source/run/include/G4UserRunAction.hh:59:
 error: `G4Run' declared as a `virtual' field
/usr/local/geant4/geant4.8.2/source/run/include/G4UserRunAction.hh:59: 
error: expected `;' before '*' token
/usr/local/geant4/geant4.8.2/source/run/include/G4UserRunAction.hh:60:
 error: expected `,' or `...' before '*' token
/usr/local/geant4/geant4.8.2/source/run/include/G4UserRunAction.hh:60:
 error: ISO C++ forbids declaration of `G4Run' with no type
/usr/local/geant4/geant4.8.2/source/run/include/G4UserRunAction.hh:61:
 error: expected `,' or `...' before '*' token
/usr/local/geant4/geant4.8.2/source/run/include/G4UserRunAction.hh:61:
 error: ISO C++ forbids declaration of `G4Run' with no type
In file included from src/ExN02EventAction.cc:34:
/usr/local/geant4/geant4.8.2/source/run/include/G4UserRunAction.hh:60: 
warning: `virtual void G4UserRunAction::BeginOfRunAction(int)' was 
hidden
include/ExN02RunAction.hh:52: warning:   by 
`void ExN02RunAction::BeginOfRunAction(const G4Run*)'
/usr/local/geant4/geant4.8.2/source/run/include/G4UserRunAction.hh:61:
 warning: `virtual void G4UserRunAction::EndOfRunAction(int)' was 
hidden
include/ExN02RunAction.hh:53: warning:   by 
`void ExN02RunAction::EndOfRunAction(const G4Run*)'
/usr/local/CLHEP/include/CLHEP/Random/Randomize.h:67: warning: 
'CLHEP::HepRandomGenActive' defined but not used
gmake: *** [/home/blais/g4work/tmp/Linux-g++/exampleN02/ExN02EventAction.o] Error 1


I have since changed the variable declaration back to what it was, but
I am still getting this error. It seems to be pointing to G4UserRunAction.hh,
but I know there is nothing wrong with this file because other examples
use it and compile without any problems.
My ExN02RunAction.hh is:



#ifndef ExN02RunAction_h
#define ExN02RunAction_h 1

#include "G4UserRunAction.hh"
#include "globals.hh"
#include "ExN02SteppingAction.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

class G4Run;

class ExN02RunAction : public G4UserRunAction
{
  public:
    ExN02RunAction();
   ~ExN02RunAction();

  public:
    void BeginOfRunAction(const G4Run*);
    void EndOfRunAction(const G4Run*);

  private:
    ExN02SteppingAction* stepaction;
};

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

#endif


And my ExN02EventAction.cc is:


#include "ExN02EventAction.hh"
#include "ExN02RunAction.hh"


#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4ios.hh"
#include "ExN02SteppingAction.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

ExN02EventAction::ExN02EventAction(ExN02RunAction* run)
:runAct(run)
{
  trackerCollID = -1;
  electronCollID = -1;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

ExN02EventAction::~ExN02EventAction()
{}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void ExN02EventAction::BeginOfEventAction(const G4Event*)
{

}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void ExN02EventAction::EndOfEventAction(const G4Event* evt)
{
  G4int event_id = evt->GetEventID();

  // get number of stored trajectories
  //
  G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
  G4int n_trajectories = 0;
  if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();

  // periodic printing
  //
  if (event_id < 100 || event_id%100 == 0) {
    G4cout << ">>> Event " << evt->GetEventID() << G4endl;
    G4cout << "    " << n_trajectories
           << " trajectories stored in this event." << G4endl;
 G4cout << "Total electrons for this event: " << total_electrons << G4endl;
  }
}

Any ideas?

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

 Add Message Add Message
to: "Weird error when compiling modified N02"

 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 ]