ROOT on VS Code

ROOT Version: 6.26/06
Platform: Windows 10 WSL2/Ubuntu 22.04
Compiler: I don’t know, how do I find it?


TL;DR Does anyone know the full configurations for setting ROOT on VS Code WSL?

Hello everyone, I’m using ROOT on windows 10 wsl without problem. Since I was already using vs code to write my macros, I installed the WSL extension by Microsoft on vs code and added the include paths to the c/c++ intellisense. But I got errors, specifying that the header files was not found and suggesting me to add the path “$ROOTSYS/include” which was already there and ,for example, I needed to “add” this same path for a few times, each from the quick fixes of includes such as TCanvas.h or TGraph.h. I tried a few more configurations such as compiler path, browse path etc. in a span of 3 hours or so but to no avail. I then uninstalled the WSL extension and installed again because of frustration. Then I followed this tutorial, no more include path errors but I cannot run the macro, it gives this error:


but my launch.json file is the same as in the tutorial and both paths are correct.

I also don’t know which compiler do I use when I succesfully run ROOT macros, I searched on the internet as to how to determine it but couldn’t find anything, an old forum post indicating cint, some documents indicating cling. Also searched through the root config files to find it but was unable to do so. How can I know the compiler that I use?

I’d really appreciate all help

EDIT: I can actually use the terminal to run the macro, I don’t really need to run it through VS Code but I’m still curious for why I couldn’t get it to run.
Also, for convenience, I tried to create a header that contains all ROOT headers using this in terminal:

$HEADER=allheaders.h
echo "#ifndef __ALL_HEADERS__" > $HEADER
echo "#define __ALL_HEADERS__" >> $HEADER
for f in $(find . -name '*.h'); 
    do echo "#include <$f>" >> $HEADER;
done
echo "#endif" >> $HEADER

But it gave me multiple errors when I included it, that dependincies could not be opened. Any idea how can I achieve it?

I have no experience with VS Code. May be @bellenot might direct you toward some solutions.

Could you help with finding the compiler that I use with ROOT?

Hi, I only use VS Code as an editor, and on native Windows, not on WSL. And to fing which compiler you have, just try g++ --version in the WSL terminal window

Sorry for the late reply. I couldn’t manage to solve the problem but I’m using the terminal in VS Code to run the macro, close enough I think. Thanks anyway.

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