Geant4 simulation working on linux, but not working on windows

Hello, I should compile and run a Geant4 11 simulation on my windows local machine that correctly works on laboratory machine (linux).

  1. I tried to compile the simulation, but I got the error:

fatal error C1083: Non è possibile aprire il file inclusione: 'G4UItcsh.hh':

i.e. it couldn’t open the G4UItcsh.hh' file.

  1. To avoid the error due to missing G4UItcsh.hh' ., I downloaded the header from laboratory machine
    G4UItcsh.hh (5.3 KB)

and I copied it in the directory

GEANT4 instaldir\include\Geant4

even if I don’t understand the reason because of the G4UItcsh.hh' was missing.

  1. I tried to compile again the simulation , but I got the error

error C2061: errore di sintassi: identificatore 'G4UItcsh'

i.e. syntax error of identificator G4UItcsh' in the main file in the lines:

else
     //start interactive session                                                                                                                                                                                   
    {
      G4UIsession* session = new G4UIterminal(new G4UItcsh);
      session->SessionStart();
      delete session;
    }

SimLuna.cc (3.3 KB)

  1. Even if I need the interactive session to temporanely try to compile the simulation I commented the lines of point 3, but now I get the errors and the warnings reported in the attached error log:
    error log.txt (8.3 KB)

@bmorgan maybe, you know how to make working the simulation on windows?

G4UItcsh.hh isn’t built on Windows as it’s not supported on that platform, so the application as coded can only work on Unix systems. To make it work on Windows, you can either:

  1. Rewrite the block to only support terminal sessions, but across platforms:

    #include "G4UIcsh.hh" // always available shell
    #ifndef _WIN32
    #include "G4UItcsh.hh"
    #endif
    
    else
        //start interactive session                                                                                                                                                                                   
        {
          G4UIsession* session = nullptr;
          #ifdef _WIN32
          session = new G4UIterminal(new G4UIcsh);
          #else
          session = new G4UIterminal(new G4UItcsh);
          #endif
    
          session->SessionStart();
          delete session;
       }
    

    The compilers on Windows should always define the _WIN32 macro, but I’m not a regular Windows user, so you should check. You can also add additional logic to select different sessions as explained in the relevant section of the Application Developer Manual

  2. Use the G4UIExecutive helper as shown in the examples, and described in the Application Developer Manual. This will select a “best” UI depending on how Geant4 was configured, or a UI can be selected using env vars or a control file.