Geant4 and HepMC

Great, thank you! :smiley: So there’s an issue with the example, let’s see if I figure whom to send the patch.

Now, the problem building all three programs is the same: the library was built for a different architecture. These are the telling lines from your build log:

'x64' del computer di destinazione [C:\setup\build\mainMCMC.vcxproj]
C:\HepMC-install\lib\HepMCfio.lib : warning LNK4272: il tipo 'x86' del computer della libreria è in conflitto con il ti
po 'x64' del computer di destinazione [C:\setup\build\mainMCMC.vcxproj]

You said that someone installed HepMC for you… I think they might have copied the files directly from a x86 computer. Building HepMC yourself should not be that difficult compared to all the other stuff we are doing here :smiley: The instructions to install it are here: INSTALL.cmake · master · HepMC / HepMC · GitLab.

Good luck!

Hello @sergio …nobody installed HepMC on my windows machine! I built HepMC my self following this tutorial

I wrote that a researcher installed it on the laboratory (linux) machine…and on that machine the simulation works fine (I run the simulation by ssh connection).

But to install HepMC on windows, the HepMC developers suggested me to modfiy the GenEvent.h adding the line (otherwise I got error during the HepMC installation)

#include <functional> to GenEvent.h

This was the installation log

log_HepMC.txt (697.7 KB)

The instructions you link contain this suspicious line:

call "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"

I suspect that it configures your environment for building 32-bit binaries. Is thre any vcvars64.bat or similar? I wonder if running that line is necessary at all, actually…

Hello @sergio

I tried to install HepMC without the call to vcvars32.bat

but still getting error

log.txt (43.7 KB)

Unfortunately, I can’t find vcvars64.bat or similiar…

You still have the same error in the log:

C:\HepMC-install\lib\HepMC.lib : warning LNK4272: il tipo 'x86' del computer della libreria è in conflitto con il tipo'x64' del computer di destinazione [C:\setup\build\mainMCMC.vcxproj]
C:\HepMC-install\lib\HepMCfio.lib : warning LNK4272: il tipo 'x86' del computer della libreria è in conflitto con il tipo 'x64' del computer di destinazione [C:\setup\build\mainMCMC.vcxproj]

Try opening a new console and build HepMC again.

That’s what I’ve done…I installed again HepMC without the

call "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"

but I always get that error…

The fact is that you are building HepMC in 32 bits and your program in 64 bits, the linker error is clear. The only thing I see that is different is that. If running it without vcvars32.bat does not help, I am out of ideas :frowning:

I also tried to build the simulation by the x86 Native Tools Command Prompt and to call the vcvars32.bat before compiling the simulation too, but I always get that error…

I am sorry that I cannot help, since I am not a Windows expert I would need to get my hands onto the computer to try to figure out the problem. I hope that now you have some hints to get your simulation running :slight_smile:

By the way, something that might be helpful is using the CMake graphical user interface and build from Visual Studio instead of the command line. It should be easier to select target architecture etc.