Windows 10 WSL VS Code : No such file or directory error


Please read tips for efficient and successful posting and posting code

_ROOT Version:_6.20
_Platform:_Windows 10 and WSL Ubuntu
Compiler: g++


Hi,

I am using the WSL with Windows 10. I am using VS code to edit the files but I continue to see an error at the include statements for all root headers ( #include <TTree.h>, ect). At compile this will throw a fatal error, no such file or directory. I can run root fine in the WSL terminal and have included “source thisroot.sh” in my .bashrc script. So I believe it is just that the compiler cannot find the root header files. My c_cpp_properties.json file looks as follows:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c11",
            "cppStandard": "c++11",
            "intelliSenseMode": "${default}"
        }
    ],
    "version": 4
}

I have tried various settings but continue to have this error. I added the path to the root directory to the “includePath”:

/<path_to_root/root/**

But this did not help either.

Any help is greatly appreciated.

Cheers,
Graham

@bellenot Can you help?

Well, I have no experience with the json configuration files, and I work on native Windows 10, which has nothing to do with WSL, which is Ubuntu based, but I will try to see what I can do…

In my ROOT source tree (in git), I have this and it works just fine:

"includePath": [
    "${workspaceFolder}/**"
],

Otherwise, for a local ROOT installation, you might have to add ${ROOTSYS}/include/** in the includePath (just trying to guess…)
Otherwise, please take a look at the c_cpp_properties.json reference and Customizing default settings

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