How exactly does ROOT work

Visual Studio 2019 Developer Command Prompt v16.5.5

Then I’m out of ideas… Can you run the tutorials?

It does basic addition and such but it cannot do anything else really. Is there a way I can use ROOT on windows using WSL such Ubuntu or something?

So even the tutorials don’t work?

Yes, but I have no experience with it. If you want to try, just search on this forum, there are several topics about it

What about using a virtual machine? Could you help me out with that?

Can you tell me if you can run any of the tutorials?

Check here for ROOT with WSL:

If you get an error from the second command in step 2, add “–fix-missing”, like this:
sudo apt install build-essential libtbb-dev libtiff5 x11-apps git --fix-missing
It works well with Ubuntu 18.04; I haven’t tried with 20.04 but should work --I tried the compiled version for 18.04 on a ‘real’ Unbuntu 20.04 and it works.

I am not able to run the tutorials // It still shows undeclared identifier cout and endl //

Can you try tutorials not using cout or endl, like for example ${ROOTSYS}/tutorials/hist/hsimple.C?

I was able to run this one just fine. It was one of the demos right? I tried th demos available and they all worked just fine.

So what did you try exactly? I asked you to try the tutorials and you said:

And now you say:

So I’m a bit confused…

I thought you meant the tutorials from:
https://root.cern/doc/master/group__Tutorials.html

The demos were accessed using ’ .demo ’ right? I could run those without any issue. I just had to click on whichever one I wanted no particular coding was involved as such.

No, I was meaning the tutorials in ${ROOTSYS}/tutorials, in your root directory

I haven’t tried. What is the command prompt to execute it?

go to the directory containing the tutorial you want to execute, start root, and type .x tutorial_name.C
For example:

**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.4.6
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'

C:\Users\bellenot>build\release\bin\thisroot.bat

C:\Users\bellenot>cd %ROOTSYS%\tutorials

C:\Users\bellenot\build\release\tutorials>root
   ------------------------------------------------------------------
  | Welcome to ROOT 6.23/01                        https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for win32 on May 20 2020, 18:23:44                         |
  | From heads/master@v6-23-01-7-g35105feb3d                         |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------


Welcome to the ROOT tutorials


Type ".x demos.C" to get a toolbar from which to execute the demos

Type ".x demoshelp.C" to see the help window

==> Many tutorials use the file hsimple.root produced by hsimple.C
==> It is recommended to execute hsimple.C before any other script

root [0] .x hsimple.C
hsimple   : Real Time =   0.93 seconds Cpu Time =   0.92 seconds
(TFile *) 0xcf7a230
root [1] .q

Taking a break from ROOT? Hope to see you back!


C:\Users\bellenot\build\release\tutorials>

And you can try with the other tutorials in sub-directories as well

Alright I’ll try that
Do you have any idea why the cout and endl won’t be identified ?

No idea…

Hi,
You can try executing using namespace std; at the ROOT prompt before you run a tutorial, or change cout and endl to std::cout and std::endl.

Thanks @eguiraud, but we already asked to try all that, without success apparently…

I figured out my mistake: Turns out my workspace was wrong;

C:\Users\bellenot>build\release\bin\thisroot.bat
C:\Users\bellenot> root

And write there:

What I tried then was:


C:\Users\bellenot>build\release\bin\thisroot.bat

C:\Users\bellenot>cd %ROOTSYS%\tutorials

C:\Users\bellenot\build\release\tutorials>root


And then I was able to execute the codes without issue.