G4cout does not not work

Dear Experts Please suggest I can print out in GEANT4
as
For Example in this code: G4Track *track = aStep->GetTrack();

track->SetTrackStatus(fStopAndKill);

G4StepPoint *preStepPoint = aStep->GetPreStepPoint();
G4StepPoint *postStepPoint = aStep->GetPostStepPoint();

G4ThreeVector posPhoton = preStepPoint->GetPosition();
G4cout<< “Photon Position” << posPhoton << G4endl;
const G4VTouchable *touchable = aStep->GetPreStepPoint()->GetTouchable();

G4int copyNo = touchable->GetCopyNumber();

G4cout << "Copy number: " << copyNo << G4endl;
G4VPhysicalVolume *physVol = touchable->GetVolume();
G4ThreeVector posDetector = physVol->GetTranslation();

I can’t print copyNo or Photon Position.

Please suggest a solution

Dear @yali,

Can you please provide more information. That being:
1.) What is the output of your code? Does it crash? or is it able to run succesfully but your print statements are unsuccesful?
2.) Do the print statements print only “Photon Position” and "Copy number: " or do they not print at all?
3.) The code sample which you have provided here, where in your code does it reside? Is it part of the G4UserSteppingAction?

Joseph

Dear @JDecunha Thanks Problem was solved.

Want to explain how, so that the next person who does a search looking for help actually finds something?

Just recompiled it starts working