How to use G4Sphere?

Hi,

whyever I’m not able to create a sphere like follows:

G4Sphere *al_hardening = new G4Sphere("al_cylinder", 10*mm, 10.5*mm, 0, 360, 0, 360);

C:\geant4\sim\construction.cc(88,86): error C2027: use of undefined type 'G4Sphere' [C:\geant4\build\toy_ex.vcxproj]
C:\Program Files\Geant4-11.0\include\Geant4\G4VGraphicsScene.hh(51): message : see declaration of 'G4Sphere' [C:\geant4\build\toy_ex.vcxproj]

Contrary,

G4Box *solidDetector = new G4Box("solidDetector", 0.026*m, 0.0045*m, 0.011*m);

is working so I wonder why

G4Sphere

isn’t?

According to Geant4ProtonTherapy < Main < TWiki it shouldn’t be false… right? Do I have to use a specific file, or so?

Thanks a lot in advance!

1 Like

It should be

G4Sphere *al_hardening = new G4Sphere("al_cylinder", 10*mm, 10.5*mm, 0, 360*deg, 0, 180*deg);

If you need a full sphere, then use G4Orb

Thank you! But even when I copy your code line, I’m receiving the same error. The same goes for G4Orb.

But why is G4Box working, then…?

Maybe You have forgotten to include “G4Sphere.hh”.
Use

#include “G4Sphere.hh”

That’s it, thanks a lot!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.