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)