I am using ROOT 6.22/02 on Windows 10 (https://root.cern/download/root_v6.22.02.win32.vc16.exe) with Visual studio Community 2019 and trying to run script hsimple.C with ACLiC and I get errors below.
I tried to run my own script, which works fine in ROOT 5.34.38, received errors and tried the tutorial hsimple.C, the errors are similar.
The output is below. Could you explain to me what I need to do differently.
C:\root_v6.22.02\tutorials>root -l hsimple.C+
Welcome to the ROOT tutorials
Type ".x demos.C" to get a toolbar from which to execute the demos
Type ".x demoshelp.C" to see the help window
==> Many tutorials use the file hsimple.root produced by hsimple.C
==> It is recommended to execute hsimple.C before any other script
root [0]
Processing hsimple.C+...
Info in <TWinNTSystem::ACLiC>: creating shared library C:/root_v6.22.02/tutorials/hsimple_C.dll
In file included from input_line_3:2:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\string:11:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xstring:14:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xmemory:16:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:15:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:137:9: error: expected member name or ';' after declaration specifiers
!_Is_implicitly_default_constructible<_Uty1>::value || !_Is_implicitly_default_constructible<_Uty2>::value)
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:137:9: error: expected ')'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:136:23: note: to match this '('
constexpr explicit(
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:24: error: expected member name or ';' after declaration specifiers
constexpr explicit(!is_convertible_v<const _Other1&, _Ty1> || !is_convertible_v<const _Other2&, _Ty2>)
~~~~~~~~~~~~~~~~~~ ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:24: error: expected ')'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:23: note: to match this '('
constexpr explicit(!is_convertible_v<const _Other1&, _Ty1> || !is_convertible_v<const _Other2&, _Ty2>)
^
In file included from input_line_3:2:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\string:11:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xstring:14:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xmemory:16:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:63:31: error: '_To' does not refer to a value
return __builtin_bit_cast(_To, _Val);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:51:17: note: declared here
template <class _To, class _From,
^
In file included from input_line_6:1:
In file included from C:/root_v6.22.02/include\Rtypes.h:23:
C:/root_v6.22.02/include/RtypesCore.h:89:14: error: redefinition of 'kTRUE'
const Bool_t kTRUE = true;
^
note: 'C:/root_v6.22.02/include/RtypesCore.h' included multiple times, additional include site here
fatal error: cannot open file 'input_line_3': no such file or directory
C:/root_v6.22.02/include\Rtypes.h:23:10: note: 'C:/root_v6.22.02/include/RtypesCore.h' included multiple times, additional include site here
#include "RtypesCore.h"
^
C:/root_v6.22.02/include/RtypesCore.h:89:14: note: unguarded header; consider using #ifdef guards or #pragma once
const Bool_t kTRUE = true;
^
Error in <ACLiC>: Executing 'C:\root_v6.22.02\bin\rootcling -v0 "--lib-list-prefix=C:\root_v6.22.02\tutorials\hsimple_C_ACLiC_map" -f "C:\root_v6.22.02\tutorials\hsimple_C_ACLiC_dict.cxx" -rml hsimple_C -rmf "C:\root_v6.22.02\tutorials\hsimple_C.rootmap" -DR__ACLIC_ROOTMAP -I%ROOTSYS%\include -D__ACLIC__ "C:/root_v6.22.02/tutorials/hsimple.C" "C:\root_v6.22.02\tutorials\hsimple_C_ACLiC_linkdef.h"' failed!
------------------------------------------------------------------
| Welcome to ROOT 6.22/02 https://root.cern |
| (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for win32 on Aug 17 2020, 12:46:52 |
| From tags/v6-22-02@v6-22-02 |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
Indeed, I remember that error. It shows up with recent versions of MSVC (Visual Studio 2019 v16.7.0 to be precise). @bellenot worked around it by defining __CUDACC__.
If you built your own ROOT you can add the following lines:
diff --git a/interpreter/cling/lib/Interpreter/CIFactory.cpp b/interpreter/cling/lib/Interpreter/CIFactory.cpp
index c01e6221e6..738666ac61 100644
--- a/interpreter/cling/lib/Interpreter/CIFactory.cpp
+++ b/interpreter/cling/lib/Interpreter/CIFactory.cpp
@@ -788,6 +788,12 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
PPOpts.addMacroDef("__CLING__GNUC_MINOR__=" ClingStringify(__GNUC_MINOR__));
#elif defined(_MSC_VER)
PPOpts.addMacroDef("__CLING__MSVC__=" ClingStringify(_MSC_VER));
+#if (_MSC_VER >= 1926)
+ // FIXME: Silly workaround for cling not being able to parse the STL
+ // headers anymore after the update of Visual Studio v16.7.0
+ // To be checked/removed after the upgrade of LLVM & Clang
+ PPOpts.addMacroDef("__CUDACC__");
+#endif
#endif
// https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
I tried the nightly build and I have the same errors.
Processing hsimple.C+...
Info in <TWinNTSystem::ACLiC>: creating shared library C:/root_v6.23.01/tutorials/hsimple_C.dll
In file included from input_line_3:2:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\string:11:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xstring:14:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xmemory:16:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:15:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:137:9: error: expected member name or ';' after declaration specifiers
!_Is_implicitly_default_constructible<_Uty1>::value || !_Is_implicitly_default_constructible<_Uty2>::value)
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:137:9: error: expected ')'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:136:23: note: to match this '('
constexpr explicit(
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:24: error: expected member name or ';' after declaration specifiers
constexpr explicit(!is_convertible_v<const _Other1&, _Ty1> || !is_convertible_v<const _Other2&, _Ty2>)
~~~~~~~~~~~~~~~~~~ ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:24: error: expected ')'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:23: note: to match this '('
constexpr explicit(!is_convertible_v<const _Other1&, _Ty1> || !is_convertible_v<const _Other2&, _Ty2>)
^
In file included from input_line_3:2:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\string:11:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xstring:14:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xmemory:16:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:63:31: error: '_To' does not refer to a value
return __builtin_bit_cast(_To, _Val);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:51:17: note: declared here
template <class _To, class _From,
^
In file included from input_line_6:1:
In file included from C:/root_v6.23.01/include\Rtypes.h:23:
C:/root_v6.23.01/include/RtypesCore.h:91:17: error: redefinition of 'kTRUE'
const Bool_t kTRUE = true;
^
note: 'C:/root_v6.23.01/include/RtypesCore.h' included multiple times, additional include site here
fatal error: cannot open file 'input_line_3': no such file or directory
C:/root_v6.23.01/include\Rtypes.h:23:10: note: 'C:/root_v6.23.01/include/RtypesCore.h' included multiple times, additional include site here
#include "RtypesCore.h"
^
C:/root_v6.23.01/include/RtypesCore.h:91:17: note: unguarded header; consider using #ifdef guards or #pragma once
const Bool_t kTRUE = true;
^
Error in <ACLiC>: Executing 'C:\root_v6.23.01\bin\rootcling -v0 "--lib-list-prefix=C:\root_v6.23.01\tutorials\hsimple_C_ACLiC_map" -f "C:\root_v6.23.01\tutorials\hsimple_C_ACLiC_dict.cxx" -rml hsimple_C -rmf "C:\root_v6.23.01\tutorials\hsimple_C.rootmap" -DR__ACLIC_ROOTMAP -I%ROOTSYS%\include -D__ACLIC__ "C:/root_v6.23.01/tutorials/hsimple.C" "C:\root_v6.23.01\tutorials\hsimple_C_ACLiC_linkdef.h"' failed!