_Geant4 Version:_10.6.3
_Operating System:_win10
_Compiler/Version:_VS 2019
_CMake Version:_3.27.9
When I built geant4 with command cmake --build . --config Release
, a large number of files reported error C2445 and LNK2005, and the geant4-install
folder was always empty.
The variables set in Cmake are as follows:
When executing command
cmake --build . --config Release
and cmake --build . --config Release --target install
in the geant4-build
folder, a lot of the same errors occured but the compile and install process was not interrupted. The error was like:
G4HadronInelasticProcess.cc
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(299,85): er
ror C2445: ?????? result ?????: ??"const G4String"?"const char [10]"?????????? [D:\geant4\geant4-build\source\processes
\G4processes.vcxproj]
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(299,85): me
ssage : ???"const G4String" [D:\geant4\geant4-build\source\processes\G4processes.vcxproj]
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(299,85): me
ssage : ? "const char *" [D:\geant4\geant4-build\source\processes\G4processes.vcxproj]
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(300,77): er
ror C2445: ?????? result ?????: ??"const G4String"?"const char [10]"?????????? [D:\geant4\geant4-build\source\processes
\G4processes.vcxproj]
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(300,77): me
ssage : ???"const G4String" [D:\geant4\geant4-build\source\processes\G4processes.vcxproj]
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(300,77): me
ssage : ? "const char *" [D:\geant4\geant4-build\source\processes\G4processes.vcxproj]
Then after the installing the geant4-install
folder is still empty.
These errors appear to be due to ambiguity in the writing of the .cc
file, but I have used the same method to install Geant4 on other machines before without such errors. And the number of such errors is too large for me to correct one by one.
After I manually modified several .cc
files, a new error appeared. The full output is as follows, and finally I use Ctrl+C to terminate the process.
d:\geant4\geant4-v11.2.0-build>cmake --build . --config Release
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Auto build dll exports
G4clhep.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bin
\G4clhep.dll
Auto build dll exports
ptl-shared.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\
bin\G4ptl.dll
Auto build dll exports
G4global.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bi
n\G4global.dll
Auto build dll exports
G4intercoms.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release
\bin\G4intercoms.dll
Auto build dll exports
G4graphics_reps.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Rel
ease\bin\G4graphics_reps.dll
Auto build dll exports
G4zlib.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bin\
G4zlib.dll
Auto build dll exports
G4materials.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release
\bin\G4materials.dll
Auto build dll exports
G4geometry.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\
bin\G4geometry.dll
Auto build dll exports
G4particles.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release
\bin\G4particles.dll
Auto build dll exports
G4track.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bin
\G4track.dll
Auto build dll exports
G4digits_hits.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Relea
se\bin\G4digits_hits.dll
Auto build dll exports
G4expat.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bin
\G4expat.dll
Auto build dll exports
G4analysis.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\
bin\G4analysis.dll
G4LatticeManager.cc
G4LatticeReader.cc
G4PhononDownconversion.cc
G4PhononPolarization.cc
G4PhononReflection.cc
G4PhononScattering.cc
G4PhononTrackMap.cc
G4VPhononProcess.cc
??????...
G4ChannelingTrackData.cc
G4ChannelingOptrMultiParticleChangeCrossSection.cc
G4ChannelingOptrChangeCrossSection.cc
G4ChannelingMaterialData.cc
G4Channeling.cc
G4ChannelingECHARM.cc
??????...
G4FastSimHitMaker.cc
G4FastSimulationHelper.cc
G4FastSimulationManager.cc
G4FastSimulationManagerProcess.cc
G4FastSimulationMessenger.cc
G4FastStep.cc
G4FastTrack.cc
G4GlobalFastSimulationManager.cc
G4VFastSimulationModel.cc
??????...
G4EnergySplitter.cc
G4ParallelWorldProcess.cc
G4ParallelWorldProcessStore.cc
G4ParallelWorldScoringProcess.cc
G4ScoreSplittingProcess.cc
??????...
G4CoupledTransportation.cc
G4NeutronKiller.cc
G4NeutronKillerMessenger.cc
G4StepLimiter.cc
G4Transportation.cc
G4TransportationParameters.cc
G4TransportationLogger.cc
G4VTrackTerminator.cc
??????...
Auto build dll exports
G4MoleculeGunMessenger.obj : error LNK2005: "public: virtual void __cdecl TG4
MoleculeShoot<class G4Track>::Shoot(class G4MoleculeGun *)" (?Shoot@?$TG4Mole
culeShoot@VG4Track@@@@UEAAXPEAVG4MoleculeGun@@@Z) ??? G4MoleculeGun.obj ??? [
D:\geant4\geant4-v11.2.0-build\source\G4processes.vcxproj]
????? D:/geant4/geant4-v11.2.0-build/BuildProducts/Release/lib/G4processe
s.lib ??? D:/geant4/geant4-v11.2.0-build/BuildProducts/Release/lib/G4proces
ses.exp
D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bin\G4processes.dll : fa
tal error LNK1169: ?????????????? [D:\geant4\geant4-v11.2.0-build\source\G4pr
ocesses.vcxproj]
Building Custom Rule D:/geant4/geant4-v11.2.0/source/CMakeLists.txt
G4InteractorMessenger.cc
G4UIArrayString.cc
G4UIcsh.cc
????????...
^C
d:\geant4\geant4-v11.2.0-build>
What should I do? Any suggestions are appriciated.