# Windows install issue with ROOT version 618/02

_ROOT Version: 6.18.02
_Platform: Window 10 Home version 1903 x64-based processor
Compiler: Not Provided
Visual Studio Community 2019 version 16.2.29215.179 installed

I am having similar issues as reported in the now closed topic
“Root 6.14.04 installation issues on Windows 10”

The installation of root 6.18.02 using the self-extraction *.exe file provided in the download page seems to proceed without a problem. But when one double clicks on the ROOT application a command-line window briefly opens, displays an error, then closes.

When ‘root’ is invoked on the command line by hand one can see this error:

``````RegOpenKeyEx(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\\$VERSION\InstallationFolder): returned 2: The system cannot find the file specified.
RegOpenKeyEx(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots\KitsRoot10): returned 2: The system cannot find the file specified.
#include <new>
^~~~~
Assertion failed: OldBuilder->DeferredDeclsToEmit.empty() && "Should have emitted all decls deferred to emit.", file C:\build\ws\BUILDTYPE\Release\LABEL\windows10\V\6-18\root\interpreter\llvm\src\tools\clang\lib\CodeGen\ModuleBuilder.cpp, line 139
``````

I have looked at previous problems which appear similar to this and it appears this issue has never actually been resolved or fixed. I’d rather not have to compile the code from scratch on my PC but if that is required I would really appreciate instructions on what to do.

Prior to loading root 6.18.02 I already pre-loaded Visual Studio community 2019 (which seemed to load and run OK) so not having visual studio present does not seem to be the problem.

Our windows expert (@bellenot) is not here for the time being. He can help you with that when back. Meanwhile @amadio may have some ideas about it.

ROOT requires a very specific version of Visual Studio to work. If the version is not the same, then this error occurs.

OK, Here is the page where one can obtain the version of root described within this thread.
https://d35c7d8c.web.cern.ch/content/release-61802

Is there someplace on this page where this is explained and also identifying exactly which version of Visual Studio is required? If not then I’d appreciate it if someone would let me know what version that is so that I can give it a try myself. Is it Visual Studio 16?

At the top of my original post I have the full version number of the version of Visual Studio I had installed before I tried to install root 6.18.02.

I don’t know what I have been doing wrong, since nothing has worked for me, but you may have better luck

I will give this a try (meaning another uninstall-reinstall of Vis. Stud. 2019 and ROOT) and report back on success or failure.

Way Hey!
It looks like I have a mostly successful result!
root does start now and it gives me a prompt, but there are quite a few errors that appear before It gets to this point.
Here is what happens when I invoke root 6.18.02 now that I seem to have loaded Visual Studio Community with the correct version of the Windows 10 SDK:

``````Microsoft Windows [Version 10.0.18362.295]

C:\Users\Todd Huffman>root
In file included from input_line_3:39:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019NEW\VC\Tools\MSVC\14.22.27905\include\cassert:5:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h:142:12: error: redefinition of '_CrtEnableIf<true, _Ty>'
struct _CrtEnableIf<true, _Ty>
^~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:142:12: note: previous definition is here
struct _CrtEnableIf<true, _Ty>
^
In file included from input_line_3:39:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019NEW\VC\Tools\MSVC\14.22.27905\include\cassert:5:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h:517:16: error: redefinition of '__crt_locale_data_public'
typedef struct __crt_locale_data_public
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:516:16: note: previous definition is here
typedef struct __crt_locale_data_public
^
In file included from input_line_3:39:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019NEW\VC\Tools\MSVC\14.22.27905\include\cassert:5:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h:524:16: error: redefinition of '__crt_locale_pointers'
typedef struct __crt_locale_pointers
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:523:16: note: previous definition is here
typedef struct __crt_locale_pointers
^
In file included from input_line_3:39:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019NEW\VC\Tools\MSVC\14.22.27905\include\cassert:5:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h:532:16: error: redefinition of '_Mbstatet'
typedef struct _Mbstatet
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:531:16: note: previous definition is here
typedef struct _Mbstatet
^
------------------------------------------------------------
| Welcome to ROOT 6.18/02                  https://root.cern |
|                               (c) 1995-2019, The ROOT Team |
| Built for win32 on Aug 23 2019, 20:56:50                   |
| From tags/v6-18-02@v6-18-02                                |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------

root [0]
``````

Are these errors of any concern? Is there any way that I can get them removed?
Cheers,
Todd

The Windows binaries per se do not require a specific compiler, it’s just that ROOT chooses to ship the pre-compiled header with the binaries, which leads to clashes. Specifically, macro names have changed between versions so you get those re-definitions b/c your local headers have different guards than the ones in the pre-compiled header.

To get around it, you need to wipe out the PCH (find it under `%ROOTSYS%/etc`, named `allDict.cxx.pch`), then rebuild it in the compiler dev environment in which you intend to use ROOT. Something like (assuming 32b here, and modulo typos):

``````% cd %ROOTSYS%
% .\bin\rootcling -rootbuild -1 -f allDict.cxx -noDictSelection -c -D__CLING__ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DROOT_PCH -fsigned-char -I.\include -I.\etc -I.\etc\dictpch -I.\etc\cling -I%ROOTSYS%\include -FIw32pragma.h -FIsehmap.h -MD -D_WINDOWS -DWIN32 -D_X86_ -D_XKEYCHECK_H -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -DSYSTEM_TYPE_winnt etc\dictpch\allHeaders.h etc\dictpch\allLinkDefs.h
``````

You can also make use of the makepch.py script that is in `%ROOTSYS%\etc\dictpch`, which may be simpler (feed it `allHeaders.h` and `allLinkDefs.h` with the flags from `allCppFlags.txt`, all in `%ROOTSYS%\etc\dictpch`).

Note that this is not a Windows-only problem, just that ROOT has several hacks to make things work on most Linuxes (e.g. a few standard headers, such as wchar.h, are shipped with ROOT, find them under `\$ROOTSYS/etc/cling` on Linux) and Mac is more conservative in its changes.

But really, ROOT should make the PCH creation part of the installation of the binaries instead of their build. Spread the word …