'cannot open file' error occurs when attempting to build example B1

My longer term goal is to build and run the example B1 program and produce the visuals associated with that example. I attempted to do this by following the installation guide instructions. I am using Geant4 version 10 (not 100% sure what number is after the decimal point (10.3,10.4, 10.6 etc.) though It may not matter). My operating system is windows 10. The compiler and vendor version is windows visual studio 2019. My current problem that I am stuck on is when I attempt to build the example B1 executable file I get an error that a file cannot be opened. In the installation guide in section “how to make an executable file” subsection “Building ExampleB1 with CMake on Windows with Visual Studio” one of the steps says to input the following command: > cmake --build . --config Release.

This command is supposed to build the executable file for example B1 under the release sub directory, however what I get instead is this output:
%HOMEPATH%\Geant4\B1-build> cmake --build . --config Release
Microsoft ® Build Engine version 16.5.0+d4cbfca49 for .NET Framework
Copyright © Microsoft Corporation. All rights reserved.
Checking Build System
Building Custom Rule %HOMEPATH%/Geant4/geant4_10_03_p03/examples/b
asic/B1/CMakeLists.txt
exampleB1.cc
B1ActionInitialization.cc
B1DetectorConstruction.cc
B1EventAction.cc
B1PrimaryGeneratorAction.cc
B1RunAction.cc
B1SteppingAction.cc
Generating Code…
%HOMEPATH%\Geant4\geant4_10_03_p03\source\analysis\accumulables\incl
ude\G4MergeMode.hh(75): warning C4715: 'G4Accumulables::GetMergeFunction<double

': not all control paths return a value [%HOMEPATH%\Geant4\B1-build
\exampleB1.vcxproj]
LINK : fatal error LNK1181: cannot open input file ‘%HOMEPATH%\Geant
4\geant4_10_03_p03-build\BuildProducts\Release\lib\G4Tree.lib’ [%HOMEPATH%\Geant4\B1-build\exampleB1.vcxproj]

What I just described is the source of the problem however I don’t know if anything I did previously caused the error that I am now trying to fix or if I have missed a step in the process. so below is a description of what I have done already and the commands and outputs I was able to copy and paste from the command line.

After downloading visual studio, cmake and the geant4 files. I started by following the installation guide in section “building and installing” under subsection “on windows platforms” I created a build directory along side the source directory named: geant4_10_03_p03-build. Then changed to that directory then configured the build by using the following command:> cmake -DCMAKE_INSTALL_PREFIX="%HOMEPATH%\Geant4\geant4_10_06-install" “%HOMEPATH%\Geant4\geant4_10_06”
[command Copied from install guide directories maybe different but the command and structure should be almost the identical]

the output of that command came out as expected. it closely resembled the output in the install guide. Then I used the command:>cmake --build . --config Release
to have cmake run the build. I then installed the headers, libraries and support files useing the command:> cmake --build . --config Release --target install
I then moved to the other section of the guide that was mentioned earlier in this post “how to make an executable file” subsection “Building ExampleB1 with CMake on Windows with Visual Studio” (this might be a mistake on my part because i may have accidentally skipped a step in the “post-install setup” however I didn’t see anything that I obviously needed to do in order create example B1)

I have the rest of the inputs and outputs of the command line contained as I followed along the “how to make an executable file” section. Below are those commands and outputs:

c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools>cd %HOMEPATH%\Geant4

%HOMEPATH%\Geant4>mkdir B1-build

%HOMEPATH%\Geant4>cd %HOMEPATH%\Geant4\B1-build

%HOMEPATH%\Geant4\B1-build>cmake -DGeant4_DIR="%HOMEPATH%\Geant4\Geant4-install\lib\Geant4-G4VERSION" “%HOMEPATH%\Geant4\B1”

CMake Error: The source directory “%HOMEPATH%/Geant4/B1” does not exist.

Specify --help for usage, or press the help button on the CMake GUI.

%HOMEPATH%\Geant4\B1-build>cmake -DGeant4_DIR="%HOMEPATH%\Geant4\Geant4-install\lib\Geant4-G4VERSION" “%HOMEPATH%\Geant4\geant4_10_03_p03\examples\basic\B1”

– Building for: Visual Studio 16 2019

– The C compiler identification is MSVC 19.25.28611.0

– The CXX compiler identification is MSVC 19.25.28611.0

– Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe

– Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe – works

– Detecting C compiler ABI info

– Detecting C compiler ABI info - done

– Detecting C compile features

– Detecting C compile features - done

– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe

– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe – works

– Detecting CXX compiler ABI info

– Detecting CXX compiler ABI info - done

– Detecting CXX compile features

– Detecting CXX compile features - done

CMake Error at CMakeLists.txt:15 (find_package):

By not providing “FindGeant4.cmake” in CMAKE_MODULE_PATH this project has

asked CMake to find a package configuration file provided by “Geant4”, but

CMake did not find one.

Could not find a package configuration file provided by “Geant4” with any

of the following names:

Geant4Config.cmake

geant4-config.cmake

Add the installation prefix of “Geant4” to CMAKE_PREFIX_PATH or set

“Geant4_DIR” to a directory containing one of the above files. If “Geant4”

provides a separate development package or SDK, be sure it has been

installed.

– Configuring incomplete, errors occurred!

See also “%HOMEPATH%/Geant4/B1-build/CMakeFiles/CMakeOutput.log”.

%HOMEPATH%\Geant4\B1-build>cd %HOMEPATH%\Geant4

%HOMEPATH%\Geant4>find_package(Geant4)

‘find_package’ is not recognized as an internal or external command,

operable program or batch file.

%HOMEPATH%\Geant4>find_package(Geant4 REQUIRED)

‘find_package’ is not recognized as an internal or external command,

operable program or batch file.

%HOMEPATH%\Geant4>cd %HOMEPATH%\Geant4\B1-build

%HOMEPATH%\Geant4\B1-build>cmake -DGeant4_DIR="%HOMEPATH%\Geant4\geant4_10_03_p03-build" “%HOMEPATH%\Geant4\geant4_10_03_p03\examples\basic\B1”

– Configuring done

– Generating done

– Build files have been written to: %HOMEPATH%/Geant4/B1-build

%HOMEPATH%\Geant4\B1-build>dir /B

ALL_BUILD.vcxproj

ALL_BUILD.vcxproj.filters

B1.sln

B1.vcxproj

B1.vcxproj.filters

CMakeCache.txt

CMakeFiles

cmake_install.cmake

exampleB1.in

exampleB1.out

exampleB1.vcxproj

exampleB1.vcxproj.filters

init_vis.mac

INSTALL.vcxproj

INSTALL.vcxproj.filters

run1.mac

run2.mac

vis.mac

ZERO_CHECK.vcxproj

ZERO_CHECK.vcxproj.filters

%HOMEPATH%\Geant4\B1-build> cmake --build . --config Release

Microsoft ® Build Engine version 16.5.0+d4cbfca49 for .NET Framework

Copyright © Microsoft Corporation. All rights reserved.

Checking Build System

Building Custom Rule %HOMEPATH%/Geant4/geant4_10_03_p03/examples/b

asic/B1/CMakeLists.txt

exampleB1.cc

B1ActionInitialization.cc

B1DetectorConstruction.cc

B1EventAction.cc

B1PrimaryGeneratorAction.cc

B1RunAction.cc

B1SteppingAction.cc

Generating Code…

%HOMEPATH%\Geant4\geant4_10_03_p03\source\analysis\accumulables\incl

ude\G4MergeMode.hh(75): warning C4715: 'G4Accumulables::GetMergeFunction<double

': not all control paths return a value [%HOMEPATH%\Geant4\B1-build

\exampleB1.vcxproj]

LINK : fatal error LNK1181: cannot open input file '%HOMEPATH%\Geant

4\geant4_10_03_p03-build\BuildProducts\Release\lib\G4Tree.lib’ [%HOMEPATH%\Geant4\B1-build\exampleB1.vcxproj]

%HOMEPATH%\Geant4\B1-build>dir/B

ALL_BUILD.vcxproj

ALL_BUILD.vcxproj.filters

B1.sln

B1.vcxproj

B1.vcxproj.filters

CMakeCache.txt

CMakeFiles

cmake_install.cmake

exampleB1.dir

exampleB1.in

exampleB1.out

exampleB1.vcxproj

exampleB1.vcxproj.filters

init_vis.mac

INSTALL.vcxproj

INSTALL.vcxproj.filters

Release

run1.mac

run2.mac

vis.mac

x64

ZERO_CHECK.vcxproj

ZERO_CHECK.vcxproj.filters

%HOMEPATH%\Geant4\B1-build>dir /B Release

%HOMEPATH%\Geant4\B1-build>cmake --DCMAKE_INSTALL_PREFIX="%HOMEPATH%\Geant4\geant4_10_03-install" “%HOMEPATH%\Geant4\geant4_10_03_p03\examples\basic\B1”

– Configuring done

– Generating done

– Build files have been written to: %HOMEPATH%/Geant4/B1-build

%HOMEPATH%\Geant4\B1-build>dir/B

ALL_BUILD.vcxproj

ALL_BUILD.vcxproj.filters

B1.sln

B1.vcxproj

B1.vcxproj.filters

CMakeCache.txt

CMakeFiles

cmake_install.cmake

exampleB1.dir

exampleB1.in

exampleB1.out

exampleB1.vcxproj

exampleB1.vcxproj.filters

init_vis.mac

INSTALL.vcxproj

INSTALL.vcxproj.filters

Release

run1.mac

run2.mac

vis.mac

x64

ZERO_CHECK.vcxproj

ZERO_CHECK.vcxproj.filters

%HOMEPATH%\Geant4\B1-build> cmake --build . --config Release

Microsoft ® Build Engine version 16.5.0+d4cbfca49 for .NET Framework

Copyright © Microsoft Corporation. All rights reserved.

LINK : fatal error LNK1181: cannot open input file '%HOMEPATH%\Geant

4\geant4_10_03_p03-build\BuildProducts\Release\lib\G4Tree.lib’

[%HOMEPATH%\Geant4\B1-build\exampleB1.vcxproj]

%HOMEPATH%\Geant4\B1-build>

In the time between the date of this reply and the date of the post above, I have posted a total of three topics relating to running exampleB1 (the above post is the first). The problems I have in this post have been resolved by uninstalling geant4 then reinstalling geant4, however new problems emerged that I don’t know how to fix which are mentioned in much more detail here (the third post)