Error C2039 '_finite' is not a member of 'std' in the file xlocnum

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version: 11.2.0
_Operating System: Windows 11
_Compiler/Version: C++ Standard ‘17’ on MS visual studio 2022
_CMake Version: 3.22.1

I’am buinding Geant4-11.2.0 from source and the build was unable to complete. the error its showing is due to some problem in the MSVC file xlocnum:

|Severity|Code|Description|Project|File|Line|Suppression State|Details|
|---|---|---|---|---|---|---|---|
|Error|C2039|'_finite': is not a member of 'std'|G4processes|C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\xlocnum|1398|||

As it was invistigated on Microsoft forume, this is a source issue for Geant4. https://github.com/Geant4/geant4/blob/860a2b92bff1fbd70bc77cf7b43f8558634763b2/source/processes/hadronic/models/lend/include/nf_specialFunctions.h#L14defines isfinite as a macro, which is all fine until other code includes a standard library header afterward which is forbidden. So, you could report a source issue to Geant4 project.

Please see solution in Compile Error with VS 2022 17.8

1 Like