**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.9.2
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community>cd C:\setup\build
C:\setup\build>cmake -DGeant4_DIR="C:\Program Files\geant4_10_07_p01_install\lib\Geant4-10.7.1" "C:\setup"
-- Building for: Visual Studio 16 2019
CMake Deprecation Warning at CMakeLists.txt:5 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.28.29913.0
-- The CXX compiler identification is MSVC 19.28.29913.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found XercesC: C:/Program Files/xerces-c-3.2.3-install/lib/xerces-c_3.lib (found suitable version "3.2.3", minimum required is "3.2.3")
-- Found OpenGL: opengl32
CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find HepMC (missing: HEPMC_INCLUDE_DIR HEPMC_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/geant4_10_07_p01_install/lib/Geant4-10.7.1/Modules/FindHepMC.cmake:27 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:30 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/setup/build/CMakeFiles/CMakeOutput.log".
See also "C:/setup/build/CMakeFiles/CMakeError.log".
C:\setup\build>
it says that it can’t find pthread.h but I installed it by vcpkg it is in the directory C:\vcpkg\vcpkg\buildtrees\pthreads\src\49e541b66c-53502e357c.clean then I setted the enviroment variable path…moreover I also copied it in the building directory of the simulation…
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community>cd C:/setup/build
C:\setup\build>cmake -DGeant4_DIR="C:\Program Files\geant4_10_07_p01_install\lib\Geant4-10.7.1" -DCMAKE_PREFIX_PATH="C:/Program Files/HepMC3-install" "C:\setup"
-- Building for: Visual Studio 16 2019
CMake Deprecation Warning at CMakeLists.txt:5 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.28.29913.0
-- The CXX compiler identification is MSVC 19.28.29913.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found XercesC: C:/Program Files/xerces-c-3.2.3-install/lib/xerces-c_3.lib (found suitable version "3.2.3", minimum required is "3.2.3")
-- Found OpenGL: opengl32
CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find HepMC (missing: HEPMC_INCLUDE_DIR HEPMC_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/geant4_10_07_p01_install/lib/Geant4-10.7.1/Modules/FindHepMC.cmake:27 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:30 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/setup/build/CMakeFiles/CMakeOutput.log".
See also "C:/setup/build/CMakeFiles/CMakeError.log".
C:\setup\build>
Thanks for the info! What’s happening is that the application’s CMakeLists.txt is searching for HepMC, not the HepMC3 that you installed - so there are two things to try:
Try installing HepMC: HepMC / HepMC. I’m not sure of its status on Windows though. After installing it, say to C:/Program Files/HepMC-install, you can point CMAKE_PREFIX_PATH to it in the same way as suggested above
Try changing the find_package(HepMC REQUIRED) in the CMakeLists.txt to find_package(HepMC3 REQUIRED). With the cmake command from before that should find HepMC3 where you installed it. However… it’s likely that if the application really uses HepMC it may not compile and error out with messages about missing headers etc.
I’d try the first option, then the second if HepMC has issues building on Windows. HepMC3 is more actively developed by the looks of things, so may be better to migrate the application to that in the long term.
C:\Windows\System32>cd C:\Program Files
C:\Program Files>git clone https://gitlab.cern.ch/hepmc/HepMC.git
Cloning into 'HepMC'...
remote: Enumerating objects: 4445, done.
remote: Counting objects: 100% (4445/4445), done.
remote: Compressing objects: 100% (967/967), done.
remote: Total 4445 (delta 3568), reused 4333 (delta 3466), pack-reused 0 eceiving objects: 100% (4445/4445), 11.30 MiB |Receiving objects: 100% (4445/4445), 11.43 MiB | 652.00 KiB/s, done.
Resolving deltas: 100% (3568/3568), done.
C:\Program Files>cd C:\Program Files\HepMC-build
C:\Program Files\HepMC-build>cmake -DHEPMC_ENABLE_ROOTIO=OFF -DCMAKE_INSTALL_PREFIX=../HepMC-install ../HepMC
-- Building for: Visual Studio 16 2019
CMake Deprecation Warning at CMakeLists.txt:17 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.28.29913.0
-- The CXX compiler identification is MSVC 19.28.29913.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:26 (message):
You must specify the momentum units with -Dmomentum=[MEV|GEV]
-- Configuring incomplete, errors occurred!
See also "C:/Program Files/HepMC-build/CMakeFiles/CMakeOutput.log".
C:\Program Files\HepMC-build>
Then I tried to replace find_package(HepMC REQUIRED)
by find_package(HepMC3 REQUIRED)
the building was succesfully but when I runned the command
cmake --build . --config Release
I got this error
C:\setup\include\HepMCG4Interface.hh(36,10): fatal error C1083: Non è possibile aprire il file inclusione: ‘HepMC/GenEvent.h’: No such fil
e or directory (compilazione del file di origine C:\setup\src\B1PrimaryGeneratorAction.cc) [C:\setup\build\mainMCMC.vcxproj]
Then I tried replacing HepMC/GenEvent.h by HepMC3/GenEvent.h
in the include\HepMCG4Interface.hh
but I get the error
C:\setup\include\HepMCG4Interface.hh(36,10): fatal error C1083: Non è possibile aprire il file inclusione: 'HepMC3/GenE
vent.h': No such file or directory (compilazione del file di origine C:\setup\src\HepMCG4Interface.cc) [C:\setup\build\
mainMCMC.vcxproj]
HepMC3/GenEvent.h by C:\Program Files\HepMC3-install\include\HepMC3\GenEvent.h
then it didn’t find HepMC3/Units.h
C:\Program Files\HepMC3-install\include\HepMC3\GenEvent.h(13,10): fatal error C1083: Non è possibile aprire il file inc
lusione: 'HepMC3/Units.h': No such file or directory (compilazione del file di origine C:\setup\src\HepMCG4Interface.cc
) [C:\setup\build\mainMCMC.vcxproj]
So I copied all the header files in HepMC3 subdirectory C:\Program Files\HepMC3-install\include\HepMC3\HepMC3
but everyttime it can’t find new things
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.9.2
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community>cd C:/setup/build
C:\setup\build>cmake -DGeant4_DIR="C:\Program Files\geant4_10_07_p01_install\lib\Geant4-10.7.1" -DCMAKE_PREFIX_PATH="C:/Program Files/HepMC3-install" "C:\setup"
-- Building for: Visual Studio 16 2019
CMake Deprecation Warning at CMakeLists.txt:5 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.28.29913.0
-- The CXX compiler identification is MSVC 19.28.29913.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found XercesC: C:/Program Files/xerces-c-3.2.3-install/lib/xerces-c_3.lib (found suitable version "3.2.3", minimum required is "3.2.3")
-- Found OpenGL: opengl32
-- Configuring done
-- Generating done
-- Build files have been written to: C:/setup/build
C:\setup\build>cmake --build . --config Release
Microsoft (R) Build Engine versione 16.9.0+57a23d249 per .NET Framework
Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati.
Checking Build System
Building Custom Rule C:/setup/CMakeLists.txt
mainMCMC.cc
G4Channeling.cc
G4ChannelingECHARM.cc
G4ChannelingMaterialData.cc
G4ChannelingOptrChangeCrossSection.cc
G4ChannelingOptrMultiParticleChangeCrossSection.cc
G4ChannelingPhysics.cc
G4ChannelingTrackData.cc
B1ActionInitialization.cc
B1DetectorConstruction.cc
B1DetectorConstructionAug.cc
B1EventAction.cc
B1PrimaryGeneratorAction.cc
C:\setup\mainMCMC.cc(225,14): warning C4244: 'inizializzazione': conversione da 'time_t' a 'G4long'. Possibile perdita
di dati. [C:\setup\build\mainMCMC.vcxproj]
B1Run.cc
B1RunAction.cc
B1RunAction2018.cc
B1StackingAction.cc
C:\Program Files\HepMC3-install\include\HepMC3\HepMC3/Errors.h(16,10): fatal error C1083: Non è possibile aprire il fil
e inclusione: 'HepMC3/Setup.h': No such file or directory (compilazione del file di origine C:\setup\src\B1PrimaryGener
atorAction.cc) [C:\setup\build\mainMCMC.vcxproj]
B1SteppingAction.cc
B1SteppingAction2018.cc
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1RunAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1RunAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1RunAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1RunAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1EventAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1EventAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1EventAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1EventAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1EventAction.cc(358,34): warning C4267: '=': conversione da 'size_t' a 'G4int'. Possibile perdita di dati
. [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1RunAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1RunAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1RunAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1RunAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1StackingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1StackingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1StackingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1StackingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1RunAction.cc(394,86): warning C4244: 'argomento': conversione da 'unsigned __int64' a 'G4double'. Possib
ile perdita di dati. [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1RunAction.cc(394,88): warning C4267: 'argomento': conversione da 'size_t' a 'G4int'. Possibile perdita d
i dati. [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1RunAction2018.cc(393,86): warning C4244: 'argomento': conversione da 'unsigned __int64' a 'G4double'. Po
ssibile perdita di dati. [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1RunAction2018.cc(393,88): warning C4267: 'argomento': conversione da 'size_t' a 'G4int'. Possibile perdi
ta di dati. [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1SteppingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1SteppingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1SteppingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1SteppingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1SteppingAction.cc(693,55): warning C4267: 'inizializzazione': conversione da 'size_t' a 'int'. Possibile
perdita di dati. [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1SteppingAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1SteppingAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1SteppingAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1SteppingAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
GEMDigitizer.cc
HepMCG4AsciiReader.cc
HepMCG4Interface.cc
PhysicsList.cc
C:\Program Files\HepMC3-install\include\HepMC3\HepMC3/Errors.h(16,10): fatal error C1083: Non è possibile aprire il fil
e inclusione: 'HepMC3/Setup.h': No such file or directory (compilazione del file di origine C:\setup\src\HepMCG4Interfa
ce.cc) [C:\setup\build\mainMCMC.vcxproj]
PhysicsListMessenger.cc
PurgMagTabulatedField3D.cc
C:\setup\src\GEMDigitizer.cc(29,14): warning C4244: 'inizializzazione': conversione da 'double' a 'int'. Possibile perd
ita di dati. [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\HepMC3-install\include\HepMC3\HepMC3/Errors.h(16,10): fatal error C1083: Non è possibile aprire il fil
e inclusione: 'HepMC3/Setup.h': No such file or directory (compilazione del file di origine C:\setup\src\HepMCG4AsciiRe
ader.cc) [C:\setup\build\mainMCMC.vcxproj]
SiDigitizer.cc
TBDetectorConstruction.cc
C:\setup\build>
Right, the issue is that the executable is still trying to use/link to the HepMC headers via the HEPMC_... variables in the CMakeLists.txt. Try changing those to to HEPMC3_....
but I still get the error that it can’t find HEPMC
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.9.2
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community>cd C:\setup\build
C:\setup\build>cmake -DGeant4_DIR="C:\Program Files\geant4_10_07_p01_install\lib\Geant4-10.7.1" -DCMAKE_PREFIX_PATH="C:/Program Files/HepMC3-install" "C:\setup"
-- Building for: Visual Studio 16 2019
CMake Deprecation Warning at CMakeLists.txt:5 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.28.29913.0
-- The CXX compiler identification is MSVC 19.28.29913.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found XercesC: C:/Program Files/xerces-c-3.2.3-install/lib/xerces-c_3.lib (found suitable version "3.2.3", minimum required is "3.2.3")
-- Found OpenGL: opengl32
-- Configuring done
-- Generating done
-- Build files have been written to: C:/setup/build
C:\setup\build>cmake --build . --config Release
Microsoft (R) Build Engine versione 16.9.0+57a23d249 per .NET Framework
Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati.
Checking Build System
Building Custom Rule C:/setup/CMakeLists.txt
mainMCMC.cc
G4Channeling.cc
G4ChannelingECHARM.cc
G4ChannelingMaterialData.cc
G4ChannelingOptrChangeCrossSection.cc
G4ChannelingOptrMultiParticleChangeCrossSection.cc
G4ChannelingPhysics.cc
G4ChannelingTrackData.cc
B1ActionInitialization.cc
B1DetectorConstruction.cc
B1DetectorConstructionAug.cc
B1EventAction.cc
B1PrimaryGeneratorAction.cc
B1Run.cc
B1RunAction.cc
B1RunAction2018.cc
B1StackingAction.cc
C:\setup\include\HepMCG4Interface.hh(36,10): fatal error C1083: Non è possibile aprire il file inclusione: 'HepMC/GenEv
ent.h': No such file or directory (compilazione del file di origine C:\setup\src\B1PrimaryGeneratorAction.cc) [C:\setup
\build\mainMCMC.vcxproj]
B1SteppingAction.cc
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1StackingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1RunAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1RunAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1EventAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1StackingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1RunAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1RunAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1RunAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1RunAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1RunAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1RunAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1StackingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1StackingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1EventAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1EventAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1EventAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1SteppingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1SteppingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1SteppingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1SteppingAction.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1EventAction.cc(358,34): warning C4267: '=': conversione da 'size_t' a 'G4int'. Possibile perdita di dati
. [C:\setup\build\mainMCMC.vcxproj]
C:\setup\mainMCMC.cc(225,14): warning C4244: 'inizializzazione': conversione da 'time_t' a 'G4long'. Possibile perdita
di dati. [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1SteppingAction.cc(693,55): warning C4267: 'inizializzazione': conversione da 'size_t' a 'int'. Possibile
perdita di dati. [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1RunAction2018.cc(393,86): warning C4244: 'argomento': conversione da 'unsigned __int64' a 'G4double'. Po
ssibile perdita di dati. [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1RunAction.cc(394,86): warning C4244: 'argomento': conversione da 'unsigned __int64' a 'G4double'. Possib
ile perdita di dati. [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1RunAction2018.cc(393,88): warning C4267: 'argomento': conversione da 'size_t' a 'G4int'. Possibile perdi
ta di dati. [C:\setup\build\mainMCMC.vcxproj]
C:\setup\src\B1RunAction.cc(394,88): warning C4267: 'argomento': conversione da 'size_t' a 'G4int'. Possibile perdita d
i dati. [C:\setup\build\mainMCMC.vcxproj]
B1SteppingAction2018.cc
GEMDigitizer.cc
HepMCG4AsciiReader.cc
HepMCG4Interface.cc
PhysicsList.cc
C:\setup\src\GEMDigitizer.cc(29,14): warning C4244: 'inizializzazione': conversione da 'double' a 'int'. Possibile perd
ita di dati. [C:\setup\build\mainMCMC.vcxproj]
PhysicsListMessenger.cc
C:\setup\include\HepMCG4Interface.hh(36,10): fatal error C1083: Non è possibile aprire il file inclusione: 'HepMC/GenEv
ent.h': No such file or directory (compilazione del file di origine C:\setup\src\HepMCG4Interface.cc) [C:\setup\build\m
ainMCMC.vcxproj]
C:\setup\include\HepMCG4Interface.hh(36,10): fatal error C1083: Non è possibile aprire il file inclusione: 'HepMC/GenEv
ent.h': No such file or directory (compilazione del file di origine C:\setup\src\HepMCG4AsciiReader.cc) [C:\setup\build
\mainMCMC.vcxproj]
PurgMagTabulatedField3D.cc
SiDigitizer.cc
TBDetectorConstruction.cc
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(106,21): warning C4996: 'write': The POSIX na
me for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details. (c
ompilazione del file di origine C:\setup\src\B1SteppingAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(393,7): warning C4996: 'close': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details. (co
mpilazione del file di origine C:\setup\src\B1SteppingAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(482,17): warning C4996: 'unlink': The POSIX n
ame for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
(compilazione del file di origine C:\setup\src\B1SteppingAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\Program Files\geant4_10_07_p01_install\include\Geant4\tools\wroot\file(495,15): warning C4996: 'open': The POSIX nam
e for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details. (com
pilazione del file di origine C:\setup\src\B1SteppingAction2018.cc) [C:\setup\build\mainMCMC.vcxproj]
C:\setup\build>
Moreover, I also tried to install HepMC (notice, I mean HepMC and not HepMC3) on my area in the machine of the laboratory (CMakeOutput.txt (47.6 KB) linux machine). Unfortunately, you can see …I got error to install it on this machine too
Hello @bgmorgan the reasercher who gave me the simulation could install HepMC on laboratory machine. Now I can build the simulation, but when I run I get this error
*************************************************************
Geant4 version Name: geant4-10-06-patch-02 [MT] (29-May-2020)
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/
**************************************************************
DIMENSIONE MAPPA: size= 41
DIMENSIONE MAPPA: max element = 25
Initializing geometry from GDML file: layout.gdml
G4GDML: Reading 'layout.gdml'...
-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : InvalidRead
issued by : G4GDMLRead::Read()
Unknown tag in gdml: head
*** Fatal Exception *** core dump ***
**** Track information is not available at this moment
**** Step information is not available at this moment
-------- EEEE -------- G4Exception-END --------- EEEE -------
*** G4Exception: Aborting execution ***
Aborted (core dumped)
I understand that it’s releated to the layout.gdml file, but I’ve it in the building directory!
Hi @bmorgan.
In these months I used the simulation by ssh connection using the laboratory machine, because they installed HepMC on that machine. To run the simulation I had to write
Now I have to revive this topic because I need the visualization and it would be very slow the visualization by ssh.
I installed HepMC and it looks like was sucesfully (I had to modify a file to install HepMC on windows…the HepMC developers helped me to do it). You can see here the installation of HepMC
You are getting a bunch of linker errors that look like this:
HepMCG4AsciiReader.obj : error LNK2019: riferimento al simbolo esterno … non risolto nella funzione …
This means that some of your code calls some external function which the linker does not find. The reason seems this:
LINK : warning LNK4044: opzione ‘/LC:/HepMC-install/lib -lHepMCfio’ non riconosciuta; verrà ignorata [C:\setup\build\mainMCMC.vcxproj]
Those options are the ones that would link your code with the HEPMCfio library, but the linker did not recognize it, and hence the library was not included. I think it may be because there is a space; there should be two options (/LC:/HepMC-install/lib and -lHepMCfio) but somehow they ended up as one.
Having a look at FindHEPMC.cmake, I do not think you are supposed to pass explicitly -DHEPMC_LIBRARIES directly to cmake; instead, you pass -DHEPMC_DIR=“C:\HepMC-install" and let FindPackage do its thing.
I am not sure if I could provide a solution, but at least I hope this helped. Good luck!
And if I may, it can be useful to change your language to English, so it easier to share your error logs
You should not pass -DHEPMC_INCLUDE_DIR either, but -DHEPMC_DIR. FindPackage will try to find HepMC in the directory given by HEPMC_INCLUDE_DIR, and give values to both HEPMC_INCLUDE_DIR and HEPMC_LIBRARIES based on what it found. This is equivalent to how you pass -DGeant4_DIR and not -DGeant4_INCLUDE_DIR. The alternative way is to give bothHEPMC_INCLUDE_DIR and HEPMC_LIBRARIES explicitly, but I think that my suggestion should work.
I see multiple problems with the FindHepMC.cmake that is shipped with Geant4. Did you manage to build any of the HepMC examples on Windows? Because it does not look possible to me.
To address your current problem, you could try replacing FindHepMC.cmake with this modified version:
# in a directory defined via HEPMC_ROOT_DIR or HEPMC_DIR environment variable
# Defines:
#
# HEPMC_FOUND
# HEPMC_INCLUDE_DIR
# HEPMC_INCLUDE_DIRS (not cached)
# HEPMC_LIBRARIES
# HEPMC_FIO_LIBRARIES
find_path(HEPMC_INCLUDE_DIR HepMC/GenEvent.h
HINTS $ENV{HEPMC_ROOT_DIR}/include ${HEPMC_ROOT_DIR}/include
$ENV{HEPMC_DIR}/include ${HEPMC_DIR}/include)
find_library(HEPMC_LIBRARIES NAMES HepMC
HINTS $ENV{HEPMC_ROOT_DIR}/lib ${HEPMC_ROOT_DIR}/lib
HINTS $ENV{HEPMC_DIR}/lib ${HEPMC_DIR}/lib)
get_filename_component(HEPMC_LIBRARY_DIR ${HEPMC_LIBRARIES} PATH)
find_library(HEPMC_FIO_LIBRARIES NAMES HepMCfio
HINTS $ENV{HEPMC_ROOT_DIR}/lib ${HEPMC_ROOT_DIR}/lib
HINTS $ENV{HEPMC_DIR}/lib ${HEPMC_DIR}/lib)
set(HEPMC_INCLUDE_DIRS ${HEPMC_INCLUDE_DIR})
# handle the QUIETLY and REQUIRED arguments and set HEPMC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HepMC DEFAULT_MSG HEPMC_INCLUDE_DIR HEPMC_LIBRARIES HEPMC_FIO_LIBRARIES)
mark_as_advanced(HEPMC_FOUND HEPMC_INCLUDE_DIR HEPMC_LIBRARIES)
Let me know if that works. Pinging @kmura, in case the examples need to be fixed for Windows. I wonder what’s the status with HepMC, since they should be the ones providing the CMake config package.
I am pretty confident that your simulation is based on one of Geant4 HepMC examples. This line
find_package(HepMC REQUIRED)
uses a FindHepMC.cmake file under the hood, which is shipped with Geant4 to support those examples.
If you check the CMake log that you posted on your first message, you can see that you are using it:
This is the file you can try modifying C:/Program Files/geant4_10_07_p01_install/lib/Geant4-10.7.1/Modules/FindHepMC.cmake.
Could you please try to build those examples, before and after modifying the file? It would be nice to know if there is a problem on Windows that needs fixing.