# How to use root (6.24/00) on Visual Studio 2019 (Windows 10)?

**URL:** <https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610>\
**Category:** Newbie\
**Created:** [June 30, 2021, 3:07pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610 "2021-06-30T15:07:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexsandro](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/51bf81/32.png) [@alexsandro](https://root-forum.cern.ch/u/alexsandro)\
**Post date:** [June 30, 2021, 3:07pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610/1 "2021-06-30T15:07:11Z")

</div>

Hi! I downloaded the binary built of root (6.24/00) for Microsoft Visual Studio 2019, then I installed it normally and set it to PATH.  
I tried to import root in a code on VS 2019 but it did not work. Is there an additional step that I have to take before using it on VS?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [June 30, 2021, 3:09pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610/2 "2021-06-30T15:09:41Z")

</div>

Welcome to the ROOT Forum!

> [@alexsandro](#):
>
> I tried to import root in a code on VS 2019 but it did not work.

I’m not sure I understand what you mean. Can you give more details? What did you try exactly?

---

<div class="post-metadata">

**Author:** ![alexsandro](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/51bf81/32.png) [@alexsandro](https://root-forum.cern.ch/u/alexsandro)\
**Post date:** [June 30, 2021, 3:18pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610/3 "2021-06-30T15:18:22Z")

</div>

Sorry. I have a python 2 code that my professor wants me to use for some charts that we need. The code needs to import root but it is not working.  
I think root is not added on VS.  
The 4th step of installation says " 4. Add the ROOT libraries and executables to your environment by sourcing the appropriate `thisroot.*` script. These setup scripts can be found in the ROOT binary release, in the `bin` directory.", but I do not know how to do that.

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [June 30, 2021, 3:27pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610/4 "2021-06-30T15:27:24Z")

</div>

OK, so now I’m confused. If you want to use ROOT from Python, here is what I would suggest:  
Open a `x86 Native Tools Command Prompt for VS 2019`, go (cd) to the directory where your code is located, call (type) `C:\root\bin\thisroot.bat` (if you installed ROOT in `C:\root\`), then start Python and you can import ROOT.  
And I still don’t understand this sentence:

> [@alexsandro](#):
>
> I think root is not added on VS.

If you want `root.exe` to be known by Visual Studio, you have to add `C:\root\bin\` in the PATH of Visual Studio, but I’m not sure why you would need that…

---

<div class="post-metadata">

**Author:** ![alexsandro](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/51bf81/32.png) [@alexsandro](https://root-forum.cern.ch/u/alexsandro)\
**Post date:** [June 30, 2021, 3:51pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610/5 "2021-06-30T15:51:06Z")

</div>

I only mean I want to be able to use it on VS.  
I did what you said and VS still shows the same warning (unresolved import ‘ROOT’). What should I do?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [June 30, 2021, 3:56pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610/6 "2021-06-30T15:56:45Z")

</div>

In your Windows settings, add a `ROOTSYS` environment variable pointing to where you installed ROOT (e.g. `C:\root`), add `%ROOTSYS%\bin` in your `PATH` and in `PYTHONPATH` (create it if it doesn’t exist). Then re-start VS

---

<div class="post-metadata">

**Author:** ![alexsandro](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/51bf81/32.png) [@alexsandro](https://root-forum.cern.ch/u/alexsandro)\
**Post date:** [June 30, 2021, 5:07pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610/7 "2021-06-30T17:07:22Z")

</div>

I did everything you said, but the warning remains.  
Can you check if I did it right?  
 ![image](https://root-forum.cern.ch/uploads/default/original/3X/3/9/39b7f620917ad3131053e26b606550c663c8ef54.png)

![image](https://root-forum.cern.ch/uploads/default/original/3X/9/a/9a91b2fd53b05240dfce710ff306d32079b4ea36.png)

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [June 30, 2021, 6:01pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610/8 "2021-06-30T18:01:40Z")

</div>

Yes, it looks OK. Can you describe exactly (step by step) what you do and what is the exact warning you got?

---

<div class="post-metadata">

**Author:** ![alexsandro](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/51bf81/32.png) [@alexsandro](https://root-forum.cern.ch/u/alexsandro)\
**Post date:** [June 30, 2021, 6:40pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610/9 "2021-06-30T18:40:23Z")

</div>

My professor told me I can use his computer. So I do not have to install it anymore.

Thank you for your help and sorry for the trouble. Should I tag it as solved?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [June 30, 2021, 7:22pm UTC](https://root-forum.cern.ch/t/how-to-use-root-6-24-00-on-visual-studio-2019-windows-10/45610/10 "2021-06-30T19:22:19Z")

</div>

Glad to see you can use it, and no problem, don’t worry!  
And no need to mark it as solved
