Root 6 and Visual Studio 2022

_ROOT Version: 6.26.10 debug
_Platform:Win11
_Compiler:VC++ 2022 (Tools v143 SDK 10.0 - ISO C++20 ISO C17)


Hello,

I had my c++ programme compiling with an older version of ROOT6 and with an older version of VS (2019) but now I upgraded to VS 2022 and the latest version of ROOT6 as above, I cannot get it to compile without throwing up a few errors. I tried various combinations of sdk, language versions etc, also vs release with root release and debug with debug and they all seem to throw up the same errors.

One thing that is a little confusing is that I keep reading that the root install executable must correspond to the exact version of visual studio installed, but I cannot see anywhere this exact visual studio configuration. In a number of places I read the term “latest” but this is not very specific:)

Any ideas would be welcome.

Below is the error output of visual studio (obviously the last error is unrelated to ROOT):

Hi, there is a known issue with the latest version of Visual Studio 2022 (17.4 and higher), which requires LLVM13 (we are working on the upgrade) for compatibility reasons. And note that C++20 is not yet supported (it should be with LLVM 13)
And about the different versions, it’s hard to tell. The situation improved a lot with VS2019, and in principle VS2019 and VS2022 should be compatible to some extend (they update every week or so, then it’s hard to tell)

Thank you for the prompt reply. Question is what to do now? Can I “roll back” to some version of root6/visual studio? Can I simply roll back the toolset or versions of language and SDK without uninstalling visual studio?

Can I have exact matching version of root6 and vs configuration?

Thanks
Dimitris

I’ll check what can be done and I’ll come back to you

The latest versions of ROOT has been built with VS 2022 v17.2.5. And I’ll try to fix the issue with the latest version of Visual Studio. For now, I don’t see an easy solution, beside re-installing either a version of VS 2022 smaller than 17.4, or VS 2019 (FYI, see `_HAS_CONDITIONAL_EXPLICIT=0` won't work with VS 2022 17.4 · Issue #10875 · root-project/root · GitHub)

ok, unfortunately I cannot roll back to an earlier version of VS2022 because microsoft won’t let me (for the community product) so I had to roll back to VS2019 Version 16.11.21. I tried compiling the same code and here is what I got:

i.e. pretty much the same thing. It makes me think that I need to roll back root6 as well.

Could you advise which exact version of ROOT will work with which exact version of VS2019? And which tool set. I tried v142 in the most recent attempt.

ROOT v6.26/10 works just fine with VS 2019 v16.11.21 MSVC v142, and Windows 10 SDK version 10.0.19041.0

And BTW, make sure you use the std:c++17 compilation flags

Hi Bertrand,
I rolled back to VS2019 and tried what you said but was getting the same errors.
Then finally I managed to dig out some older version of the code and checked the settings to be

root_v5.34.38 release x86

This compiled just fine.

Could it be the fact that I am using ROOTCINT to generate the dictionary as opposed to CLINT?

I read that RootCint in ROOT6 is just an alias to CLINT so I assumed that it works. But one of the two errors I am getting is in the Streamer class, so could it be that I am not generating the correct dictionary?

To clarify, I am using the exact rootcint command I was using for root5 with the same linkdef file.

Well, this should not be compatible with VS 2019 or VS 2022…

AFAIK, rootcint and rootcling should be compatible

Maybe, but it still looks like a c++ version compatibility error to me

Hi Bertrand,
can I propose something? I think it would save people like me tons of time if for each version of root binaries download, if there was a full “hello world project” in visual studio, or any of the other supported platforms, with all the settings pre-set. So one could download this, load it in their favourite editor and compile it straight away. Then they can paste their code in it and get going immediately.

It is remarkable that after weeks of trials and following your advice, I got it to work in a way you didn’t think it would work, and I could not get it to work in the way you thought it would. Sure maybe I put the wrong setting somewhere but it shouldn’t need to be like that.

Thanks
Dimitris

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.