Compiled successfully but executable is showing error

Geant4 Version: Geant4-11-02-patch-02 [MT]
Operating System: Ubuntu
Compiler/Version: g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0
CMake Version: cmake version 3.28.3

The terminal is showing this:

Available UI session types: [ Qt, tcsh, csh ]
terminate called after throwing an instance of ‘std::logic_error’
what(): basic_string: construction from null is not valid
Aborted (core dumped)

This is a fairly common cpp error typically seen with accidentally initializing a string with null. Something like:

string myVariable = 0;

instead of

string myVariable;

Are you running a basic example or your own code?

1 Like

@msa-Mahfuj

Some suggestions might be fruitful for you to compile your first example.

You need to re-build geant4 project as I assume some pre-requisite maybe missing.
You need to install them before building geant4 project.

I have written a single line command, you need to run from terminal.

sudo apt-get install build-essential libexpat1-dev libxmu-dev cmake cmake-curses-gui qt5-default -y

Once done ! Re-build Geant4 project.

Ref: Geant4 System/Software Prerequisites — Geant4 Installation Guide 11.2 documentation

VRS

1 Like

@drvijayraj I don’t think these are relevant, as Geant4/the example wouldn’t have compiled/linked at all if these weren’t present in the first place.

@msa-Mahfuj, in addition to what @jrellin suggested, you could also try running the example through the gdb debugger, which could help to track down the location of the exception. There are several posts on the Forum on use of this, just search for “gdb”.

1 Like

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