Using ROOT Libraries in Visual Studio

Hello,

Can someone please help me as I am rather stuck.

I have been learning C++ and writing a program for which I want to include ROOT in.

My code editor is Visual Studio, and I have followed the instructions for installing ROOT on Windows 10 (as I want to simply run in native windows), I have all of the dependencies, however after following the instructions to install ROOT, Visual Studio cannot compile my code as it tells me the ROOT files I am attempting to include cannot be found.

Can someone please give me a step by step guide as to how use ROOT libraries correctly while using Visual Studio.

Would really appreciate this help as I require they use of ROOT for my forthcoming MPhys project.

Thank you very much in advance,
Adam

Hi Adam,

Thanks for posting!
Could you provide us with a minimal reproducer of the setup you have so that our Windows expert gan give feedback? Right now it seems that too much guess-work would need to be done hereā€¦

Cheers,
Danilo

Yes indeed,

I am running:
Windows 10
Visual Studio 2022 v17.7 (C++ Desktop Development installed)
Root v6.28/06 (installed from https://root.cern/download/root_v6.28.06.win64.vc17.exe)

I hope this gives some context and you will be able to help me with how to include working ROOT libraries in my C++ code written in visual studio.

You must add the ROOT include and lib directories in your Visual Studio project settings. Note that I would suggest to use CMake to generate your solution (project) file in order to keep the same C++ flags than the ones used to build ROOT.

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