0

After compiling successfully via CMake, I'm now stuck at another point:

img

When I press Retry, nothing happens except that I get back control over the prompt:

(base) PS C:\geant4\build\Debug> toy_ex.exe

**************************************************************
 Geant4 version Name: geant4-11-00-patch-01 [MT]   (8-March-2022)
                       Copyright : Geant4 Collaboration
                      References : NIM A 506 (2003), 250-303
                                 : IEEE-TNS 53 (2006), 270-278
                                 : NIM A 835 (2016), 186-225
                             WWW : http://geant4.org/
**************************************************************

(base) PS C:\geant4\build\Debug>

I don't know what to expect, the program itself is running fine. I only want to set up the compiler into debugging mode so I can get as much information as possible when I'm trying to program further things via Geant4.

edit: This is the .sln file:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ALL_BUILD", "ALL_BUILD.vcxproj", "{864FDEB9-6432-307E-9AA5-54FC01B38A99}"
    ProjectSection(ProjectDependencies) = postProject
        {1B4B775D-725E-344B-8220-F2A19C0E8B19} = {1B4B775D-725E-344B-8220-F2A19C0E8B19}
        {5794228B-9573-38C7-9F64-CA83A5E015D5} = {5794228B-9573-38C7-9F64-CA83A5E015D5}
    EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TOY_EXAMPLE", "TOY_EXAMPLE.vcxproj", "{7C821F0C-2DA7-300C-9FB9-636C29E1D59D}"
    ProjectSection(ProjectDependencies) = postProject
        {1B4B775D-725E-344B-8220-F2A19C0E8B19} = {1B4B775D-725E-344B-8220-F2A19C0E8B19}
        {5794228B-9573-38C7-9F64-CA83A5E015D5} = {5794228B-9573-38C7-9F64-CA83A5E015D5}
    EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZERO_CHECK", "ZERO_CHECK.vcxproj", "{1B4B775D-725E-344B-8220-F2A19C0E8B19}"
    ProjectSection(ProjectDependencies) = postProject
    EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "toy_ex", "toy_ex.vcxproj", "{5794228B-9573-38C7-9F64-CA83A5E015D5}"
    ProjectSection(ProjectDependencies) = postProject
        {1B4B775D-725E-344B-8220-F2A19C0E8B19} = {1B4B775D-725E-344B-8220-F2A19C0E8B19}
    EndProjectSection
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|x64 = Debug|x64
        Release|x64 = Release|x64
        MinSizeRel|x64 = MinSizeRel|x64
        RelWithDebInfo|x64 = RelWithDebInfo|x64
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {864FDEB9-6432-307E-9AA5-54FC01B38A99}.Debug|x64.ActiveCfg = Debug|x64
        {864FDEB9-6432-307E-9AA5-54FC01B38A99}.Release|x64.ActiveCfg = Release|x64
        {864FDEB9-6432-307E-9AA5-54FC01B38A99}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
        {864FDEB9-6432-307E-9AA5-54FC01B38A99}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
        {7C821F0C-2DA7-300C-9FB9-636C29E1D59D}.Debug|x64.ActiveCfg = Debug|x64
        {7C821F0C-2DA7-300C-9FB9-636C29E1D59D}.Release|x64.ActiveCfg = Release|x64
        {7C821F0C-2DA7-300C-9FB9-636C29E1D59D}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
        {7C821F0C-2DA7-300C-9FB9-636C29E1D59D}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
        {1B4B775D-725E-344B-8220-F2A19C0E8B19}.Debug|x64.ActiveCfg = Debug|x64
        {1B4B775D-725E-344B-8220-F2A19C0E8B19}.Debug|x64.Build.0 = Debug|x64
        {1B4B775D-725E-344B-8220-F2A19C0E8B19}.Release|x64.ActiveCfg = Release|x64
        {1B4B775D-725E-344B-8220-F2A19C0E8B19}.Release|x64.Build.0 = Release|x64
        {1B4B775D-725E-344B-8220-F2A19C0E8B19}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
        {1B4B775D-725E-344B-8220-F2A19C0E8B19}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
        {1B4B775D-725E-344B-8220-F2A19C0E8B19}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
        {1B4B775D-725E-344B-8220-F2A19C0E8B19}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
        {5794228B-9573-38C7-9F64-CA83A5E015D5}.Debug|x64.ActiveCfg = Debug|x64
        {5794228B-9573-38C7-9F64-CA83A5E015D5}.Debug|x64.Build.0 = Debug|x64
        {5794228B-9573-38C7-9F64-CA83A5E015D5}.Release|x64.ActiveCfg = Release|x64
        {5794228B-9573-38C7-9F64-CA83A5E015D5}.Release|x64.Build.0 = Release|x64
        {5794228B-9573-38C7-9F64-CA83A5E015D5}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
        {5794228B-9573-38C7-9F64-CA83A5E015D5}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
        {5794228B-9573-38C7-9F64-CA83A5E015D5}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
        {5794228B-9573-38C7-9F64-CA83A5E015D5}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {297A9E1A-FABA-3B58-9C68-28A09C508BAE}
    EndGlobalSection
    GlobalSection(ExtensibilityAddIns) = postSolution
    EndGlobalSection
EndGlobal

Visual studio screenshot: img2

Ben
  • 1,432
  • 4
  • 20
  • 43
  • 2
    Have you tried running this from the visual studio solution generated by cmake? (You may need to adjust the debugger environement in your cmake project e.g. for dlls to be loaded properly) – fabian Jul 05 '22 at 17:20
  • tbh, Idk. First I used " cmake -S C:\geant4\sim -B C:\geant4\build -G "Visual Studio 17 2022" " in the terminal and then " cmake --build C:\geant4\build --config Debug ". Then I navigate into the Debug folder and run the .exe file "toy_ex.exe". – Ben Jul 06 '22 at 05:07
  • Often this is caused by an exception that has not been caught properly. Open the `.sln` file from your build folder in Visual Studio. Then lookup the target producing the `toy_ex.exe` in the `Solution Explorer`. Right click on it and select `Set as startup project` from the context menu. Finally debug the executable by running it with `F5` under the debugger. If some of the DLLs could not be found you neeed to adjust the debugging environment as @fabian suggested. – vre Jul 06 '22 at 06:09
  • Or you can just hit the retry button on that dialog, which will open the debugger for you at the point where the application has caught the abort. – Botje Jul 06 '22 at 09:21
  • @vre Thank you! I think it's working in Visual Studio though I'm not quite sure what I have to look for when I follow your instructions it looks like debugging information at the end. But this is quite an effort for everytime I change something in the code. I'm used to test code every 1-2 minutes. – Ben Jul 06 '22 at 09:25
  • @Botje In principle but nothing happens when I do so – Ben Jul 06 '22 at 09:25
  • @Ben I am not familiar with Geant programming, so I'm out. But a std::bad_alloc exception is thrown if you try to alloc a huge amount of memory that cannot be served by the runtime system. Maybe something tries to alloc an array with size -1. But that's a wild guess. You need to debug/step into the first new call to find out the reason. And to avoid the abort(), place the calls in a try/catch block. – vre Jul 06 '22 at 09:42
  • Sure, thanks a lot nevertheless. But is this the debugging I'm looking for? It is so different from what I'm used on Linux, I feel like a rookie.. – Ben Jul 06 '22 at 09:49

0 Answers0