I downloaded and installed the latest version of Visual Studio 2019 on my Windows 10 computer. I followed the few directions that I found here, and everything seemed very straightforward. With it I can compile and run simple code Then I grabbed a very recent pre-compiled version of root that appears to have been compiled with the same compiler. When I run root, I get this:
Z:\My Documents\root-play>root -l
In file included from input_line_3:39:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\\include\cassert:5:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.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\2019\Community\VC\Tools\MSVC\14.21.27702\\include\cassert:5:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:516:16: error: redefinition of '__crt_locale_data_public'
typedef struct __crt_locale_data_public
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\crtdefs.h:10:10: note: 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h' included multiple times, additional include
site here
#include <corecrt.h>
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\assert.h:12:10: note: 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h' included multiple times, additional include
site here
#include <corecrt.h>
^
In file included from input_line_3:39:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\\include\cassert:5:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:523:16: error: redefinition of '__crt_locale_pointers'
typedef struct __crt_locale_pointers
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\crtdefs.h:10:10: note: 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h' included multiple times, additional include
site here
#include <corecrt.h>
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\assert.h:12:10: note: 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h' included multiple times, additional include
site here
#include <corecrt.h>
^
In file included from input_line_3:39:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\\include\cassert:5:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\assert.h:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h:531:16: error: redefinition of '_Mbstatet'
typedef struct _Mbstatet
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\crtdefs.h:10:10: note: 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h' included multiple times, additional include
site here
#include <corecrt.h>
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\assert.h:12:10: note: 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h' included multiple times, additional include
site here
#include <corecrt.h>
^
root [0]
Nasty, but it is working. Back with Visual Studio 2013 and root 5.34.14, I didn’t get any errors. I get these errors whether i open a “Visual Studio developer” window or a plain window.
Then I tried compiling code from within root using the “Visual Studio developer” DOS window. It’s the simple slits.cpp program that is found in the tutorial. Without the “+” at the end, it works fine, but with the “+” I get:
root [0] .L slits.cpp+
Info in <TWinNTSystem::ACLiC>: creating shared library Z:/My Documents/root-play/slits_cpp.dll
slits_cpp_ACLiC_dict.cxx
Creating library Z:/My Documents/root-play\slits_cpp.lib and object Z:/My Documents/root-play\slits_cpp.exp
LINK : fatal error LNK1181: cannot open input file 'VCRUNTIME140.lib'
Error in <ACLiC>: Compilation failed!
root [1]
This too worked back with VS 2013 and root 5.34.14 without any errors. I’ve tried all kinds of things like downloading a different version of root or adding some older stuff to my Visual Studio distribution, e.g., an older SDK, but nothing gets rid of these errors. I’ve scoured the internet looking for a solution, but I haven’t found one. I’d rather not resort to downloading VS 2013 and root 5.34.14 on my brand new computer.
I did trying building root from the ground floor up, but that didn’t work either. I used cmake and some instructions that I gleaned from the forum here, but it complains about missing file pthread.h and one other thing and then dies.
Thank you for any help you can provide.
_ROOT Version: Release 6.18/00 - 2019-06-25
_Platform: Windows 10
_Compiler: Visual Studio 2019