How to include CERN root directory in c_cpp_properties.json of Visual Studio running in Ubuntu?

I have recently installed Visual Studio on Ubuntu to help me with writing Geant4 code, and it’s awesome. However try as I may I can not find a way to include the CERN Root directories into c_cpp_properties.json so that I can develop Root scripts in Visual Studio in order that I can process my simulated data.

CERN Root is working on my computer using my Sublime text editor. I have tried to locate the CERN Root header files but I can’t seem to find them as easily as I did for Geant4, and I don’t understand why?

Below is my c_cpp_properties.json script. For what it’s worth, I would appreciated immensely if someone could help me understand how to include CERN Root directories into c_cpp_properties.json so that I can write Root scripts in Visual Studio.

Thank you for your time

Peter

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${G4INCLUDES}/**",
                "/home/compton/Documents/geant4.10.05.p01/geant4-install/share/Geant4-10.5.1/examples/extended/polarisation/Pol01/include",
                "/home/compton/Documents/geant4.10.05.p01/geant4-install/share/Geant4-10.5.1/examples/extended/polarisation/Pol01/src",
                "/home/compton/Documents/geant4.10.05.p01/source/run/include"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu18",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

It should just be a case of locating the directory containing the ROOT headers and putting that as an additional item in includePath. They are usually installed under a single directory, so if you can find the directory holding, for example, TFile.h, that should be the one to add. How did you install ROOT, as that should indicate where the headers are (e.g. run root-config --incdir)?

Maybe also worth asking on the ROOT forum for specifics.

1 Like

Typing root-config --incdir to find the Root directory worked perfectly!

Thank you so much, bmorgan!