Skip to content

Headers from WSL unrecognizable when includePath set correctly #1802

Description

@Blealtan

When setting includePath to paths from Windows Subsystem for Linux, the headers in it aren't recognized and causes errors like cannot find source file "stdio.h".

To reproduce, use the following c_cpp_properties.json with the user name and WSL system directory name replaced:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "C:/Users/Blealtan/AppData/Local/Packages/TheDebianProject.DebianGNULinux_76v4gfsz19hv4/LocalState/rootfs/usr/include",
                "C:/Users/Blealtan/AppData/Local/Packages/TheDebianProject.DebianGNULinux_76v4gfsz19hv4/LocalState/rootfs/usr/local/include"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "C:/Users/Blealtan/AppData/Local/Packages/TheDebianProject.DebianGNULinux_76v4gfsz19hv4/LocalState/rootfs/usr/include",
                    "C:/Users/Blealtan/AppData/Local/Packages/TheDebianProject.DebianGNULinux_76v4gfsz19hv4/LocalState/rootfs/usr/local/include"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 3
}

Then create a new C source file, add #include <stdio.h>, error occurs.

The file stdio.h does exist under specified include path:

PS C:\Users\Blealtan\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\LocalState\rootfs\usr\include> ls stdio.h


    目录: C:\Users\Blealtan\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\LocalState\rootfs\usr\include


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         2018/4/9      1:50          31494 stdio.h

Also, when setting log level to Information, it shows below messages:

Unable to retrieve file system information for C:/Users/Blealtan/AppData/Local/Packages/TheDebianProject.DebianGNULinux_76v4gfsz19hv4/LocalState/rootfs/usr/include. error = -1
Unable to retrieve file system information for C:/Users/Blealtan/AppData/Local/Packages/TheDebianProject.DebianGNULinux_76v4gfsz19hv4/LocalState/rootfs/usr/local/include. error = -1

I haven't faced with this issue before recently updating to latest Windows Insider (slow). Recent builds seems to have updated stuffs around the filesystem of WSL, which might be related.

Extra information:

  • Operating System: Windows 10 Build 17127
  • VS Code version: March 2018 (version 1.22, non-insider)
  • C/C++ extension: Version 0.16.1
  • Other extensions: unrelated; issue persists after disabled

Activity

  1. bobbrow commented on Apr 9, 2018

    @bobbrow
    Contributor

    May be a duplicate of #1694. I haven't had a chance to try this out on a more recent Windows Insider build than the one mentioned in that issue.

  2. Blealtan commented on Apr 11, 2018

    @Blealtan
    Author

    Yes this should be a duplicate; 17115 does be near the build which I started to have this issue. I'll close this issue for now and provide my information in that one. Thank you for pointing out.

  3. locked and limited conversation to collaborators on Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions