Compiling Macro Error Linking Issue

Hi I recently downloaded the ROOT 6.24.06 Windows binary .exe with a Visual Studio 2022 as my compiler. I am new to both Root and c++ in general attempting to compile a macro that had been sent to me by others who had been using it on a different version of root and works with both Linux and MacOS.

In the root command line I typed .L dig.C+O which is in my macros folder within ROOT. As a new user I cannot upload a snip of the error but I will type out the output text surrounding the fatal error to start.

note: ‘C:/root_v6.24.06/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.24.06/include\Rtypes.h:23:10: note: ‘C:/root_v6.24.06/include/RtypesCore.h’ included multiple times, additional include site here “RtypesCore.h”

I apologize that this is an inefficient way of showing the full error text, I could upload the full output message if need be including the non fatal errors. I’m not exactly sure what ‘input_line_3’ is referring to and I am unsure at the switch between / and \ in the fatal error statement.

ROOT Version: 6.24.06
Platform: Windows
Compiler: Visual Studio Community 2022


Welcome to the ROOT Forum!
First, you might encounter some issues with a different version of Visual Studio than the one used to build the binary you downloaded, but let’s try nevertheless. I suppose you started ROOT from a x86 Native Tools Command Prompt for VS 2022 ?

Well, you can copy & paste the text of the error message in your post. Anyway, can you run any of the ROOT tutorials? First interpreted (e.g. .x hsimple.C) and then compiled with ACLiC (e.g. .x hsimple.C+)

I have started root both through the desktop shortcut which pulls up a command prompt and starting root from a VS 2022 command prompt (not 100% about the x86 Native Tools part)

Both methods I can run the .x hsimple.c but cannot compile and get the same error as I did when trying to compile other macros.

Here is the my input of the macro working and then the input and outputs of the compiler error when I tried to compile it.

*root [0] .x hsimple.c
*hsimple : Real Time = 0.57 seconds Cpu Time = 0.56 seconds
*(TFile *) 0xcc65bf0
*root [1] .x hsimple.c+
*Info in : script has already been loaded in interpreted mode
*Info in : unloading C:\root_v6.24.06\macros\hsimple.c and compiling it
*Info in : creating shared library C:/root_v6.24.06/macros/hsimple_c.dll
*In file included from input_line_3:2:
*In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\string:11:
*In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\xstring:14:
*In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\xmemory:16:
*In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\xutility:15:
*C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\utility:131:9: error: expected member name or ‘;’ after declaration specifiers
!conjunction_v<_Is_implicitly_default_constructible<_Uty1>, _Is_implicitly_default_constructible<_Uty2>>)
^
*C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\utility:131:9: error: expected ‘)’
*C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\utility:130:23: note: to match this ‘(’
constexpr explicit(
^
*C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\utility:217:24: error: expected member name or ‘;’ after declaration specifiers
constexpr explicit(!conjunction_v<is_convertible<const _Other1&, _Ty1>, is_convertible<const _Other2&, _Ty2>>)
~~~~~~~~~~~~~~~~~~ ^
*C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\utility:217:24: error: expected ‘)’
*C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\utility:217:23: note: to match this ‘(’
constexpr explicit(!conjunction_v<is_convertible<const _Other1&, _Ty1>, is_convertible<const Other2&, Ty2>>)
^
*In file included from input_line_4:2:
*In file included from C:/root_v6.24.06/include\Rtypes.h:23:
*C:/root_v6.24.06/include/RtypesCore.h:91:17: error: redefinition of ‘kTRUE’
const Bool_t kTRUE = true;
^
*note: ‘C:/root_v6.24.06/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.24.06/include\Rtypes.h:23:10: note: ‘C:/root_v6.24.06/include/RtypesCore.h’ included multiple times, additional include site here
#include “RtypesCore.h”
^
*C:/root_v6.24.06/include/RtypesCore.h:91:17: note: unguarded header; consider using #ifdef guards or #pragma once
const Bool_t kTRUE = true;
^
Error in : Executing 'C:\root_v6.24.06\bin\rootcling -v0 “–lib-list-prefix=C:\root_v6.24.06\macros\hsimple_c_ACLiC_map” -f "C:\root_v6.24.06\macros\hsimple_c_ACLiC_dict.cxx" -rml hsimple_c -rmf *“C:\root_v6.24.06\macros\hsimple_c.rootmap” -DR__ACLIC_ROOTMAP -I%ROOTSYS%\include -D__ACLIC
*“C:/root_v6.24.06/macros/hsimple.c” “C:\root_v6.24.06\macros\hsimple_c_ACLiC_linkdef.h”’ failed!
*root [2]

OK, so this is because ROOT v6.24.06 has been build with a too old and incompatible version of Visual Studio. You might consider downloading a nightly build, or wait for the upcoming version 6.26.00. I just tested the latest nightly (root_v6.27.01.win32.vc.zip) built with VS 2019, running with VS2022 and it works just fine.

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.0.5
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'

C:\Users\sftnight>cd Downloads\root

C:\Users\sftnight\Downloads\root>bin\thisroot.bat

C:\Users\sftnight\Downloads\root>cd tutorials

C:\Users\sftnight\Downloads\root\tutorials>root -l

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] .x hsimple.C+
Info in <TWinNTSystem::ACLiC>: creating shared library C:/Users/sftnight/Downloads/root/tutorials/hsimple_C.dll
hsimple_C_ACLiC_dict.cxx
   Creating library C:/Users/sftnight/Downloads/root/tutorials\hsimple_C.lib and object C:/Users/sftnight/Downloads/root/tutorials\hsimple_C.exp
hsimple_C_ACLiC_dict.cxx
   Creating library C:/Users/sftnight/Downloads/root/tutorials\hsimple_C.lib and object C:/Users/sftnight/Downloads/root/tutorials\hsimple_C.exp
hsimple   : Real Time =   1.34 seconds Cpu Time =   1.28 seconds
(TFile *) 0x7495ce0
root [1]
2 Likes

Hi Thanks for offering this help this seemed to work, I can now compile both the hsimple and the macro that was supplied to me.

A new issue arose with this as I try to use a function within it that pulls up a bunch of plots. After a time I get a message that I do not have enough memory (which is odd to me as I have 32Gb ram and previous computers had successfully used this function without memory issues). Should I open this up in a different thread or stay here?

Please create a a new topic