Entry Point Not Found (file.exe)

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version: 11.2.1
_Operating System: Windows 10
_Compiler/Version: Visual Studio 17.11
_CMake Version:3.30.2


Hello
I am trying to run a previously generated .exe file, but the error below appears. I have reinstalled Geant4 on another device. The code is running well, and B1’s simple example works fine. Do you have any idea how to solve this error?

Thanks in advance.

BabySteps_3.exe - Entry Point Not Found
The procedure entry point ??0G4VUserDetectorConstruction@@QEAA@XZ could not be located in the dynamic link library
C:\Users\morad.hamad\Geant4\geant4-v11.2.1\share\Geant4\examples\Research\Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\Release\BabySteps_3.exe.

Difficult to say, but if you generated this executable on a different machine and different version of Geant4, that can lead to various incompatibility issues. As B1 is working, have you tried recompiling this other application on the new machine?

Thank you for your response. Yes, I have tried recompiling the code but I get the following error:

CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: 'C:/Users/morad.hamad/Geant4/geant4-v11.2.1/11.2.1/share/Geant4/examples/Research Project/StepsByStepConstruction/5-CollimatorsAndDetector/build/CMakeFiles/CMakeScratch/TryCompile-0v4mmv'
    
    Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe" cmTC_80899.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n
    MSBuild version 17.12.6+db5f6012c for .NET Framework

    Build started 11/21/2024 7:42:57 PM.

    

    Project "C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj" on node 1 (default targets).

    PrepareForBuild:

      Creating directory "cmTC_80899.dir\Debug\".

      Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.

      Creating directory "C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\Debug\".

      Creating directory "cmTC_80899.dir\Debug\cmTC_80899.tlog\".

    InitializeBuildStatus:

      Creating "cmTC_80899.dir\Debug\cmTC_80899.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.

      Touching "cmTC_80899.dir\Debug\cmTC_80899.tlog\unsuccessfulbuild".

    ClCompile:

      C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX64\x64\CL.exe /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_80899.dir\Debug\\" /Fd"cmTC_80899.dir\Debug\vc143.pdb" /external:W3 /Gd /TC /errorReport:queue "C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\testCCompiler.c"

      Microsoft (R) C/C++ Optimizing Compiler Version 19.42.34433 for x64

      Copyright (C) Microsoft Corporation.  All rights reserved.

      cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_80899.dir\Debug\\" /Fd"cmTC_80899.dir\Debug\vc143.pdb" /external:W3 /Gd /TC /errorReport:queue "C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\testCCompiler.c"

      testCCompiler.c

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003: The specified task executable "CL.exe" could not be run. System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.dir\Debug\cmTC_80899.tlog'. [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.FileSystemEnumerableIterator`1.CommonInit() [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.Directory.GetFiles(String path, String searchPattern) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.Utilities.TrackedDependencies.ExpandWildcards(ITaskItem[] expand) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.Utilities.CanonicalTrackedOutputFiles.InternalConstruct(ITask ownerTask, ITaskItem[] tlogFiles, Boolean constructOutputsFromTLogs) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.CL.PostExecuteTool(Int32 exitCode) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.TrackedVCToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.CL.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.Utilities.ToolTask.Execute() [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    Done Building Project "C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj" (default targets) -- FAILED.

    

    Build FAILED.

    

    "C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj" (default target) (1) ->

    (ClCompile target) -> 

      C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003: The specified task executable "CL.exe" could not be run. System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.dir\Debug\cmTC_80899.tlog'. [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.FileSystemEnumerableIterator`1.CommonInit() [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.Directory.GetFiles(String path, String searchPattern) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.Utilities.TrackedDependencies.ExpandWildcards(ITaskItem[] expand) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.Utilities.CanonicalTrackedOutputFiles.InternalConstruct(ITask ownerTask, ITaskItem[] tlogFiles, Boolean constructOutputsFromTLogs) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.CL.PostExecuteTool(Int32 exitCode) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.TrackedVCToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.CL.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.Utilities.ToolTask.Execute() [C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project\StepsByStepConstruction\5-CollimatorsAndDetector\build\CMakeFiles\CMakeScratch\TryCompile-0v4mmv\cmTC_80899.vcxproj]

    

        0 Warning(s)

        1 Error(s)

    

    Time Elapsed 00:00:02.70

    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


Configuring incomplete, errors occurred!

My CMakeLists.txt is:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(BabySteps_3)

find_package(Geant4 REQUIRED ui_all vis_all)

include(${Geant4_USE_FILE})

include_directories(${PROJECT_SOURCE_DIR}/include)

file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)

add_executable(BabySteps_3 main.cc ${sources} ${headers})
target_link_libraries(BabySteps_3 ${Geant4_LIBRARIES})

#add_custom_target(BabySteps_2 DEPENDS main)



Focussing on this line and error message, there’s not a huge amount to go on online regarding that error message so I can only give a couple of pointers/suggestions:

  • If this wasn’t already a fresh, from scratch build, try deleting the build directory (for this application) and starting a fresh one. This is to confirm that there’s no caching/copying issues.
  • Based on this same issue in a post on the CMake Discourse, it might be that the path is too long (though my count is below the 260 character limit mentioned).
    • Try moving the folder with your codes C:\Users\morad.hamad\Geant4\geant4-v11.2.1\11.2.1\share\Geant4\examples\Research Project to, say C:\Users\morad.hamad\Geant4\Research Project to shorten the path and see if that helps.
    • This is any case better practice so you don’t mix up your code with that of the toolkit.

Awesome!
Thank you very much for your help. I moved the code to another shorter path per your guidance, and it works perfectly!

Have a nice day!

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