Describe the bug
Have you seen this documentation?
What I did was adding to the c_cpp_properties.json
file (inside .vscode folder) and add the include paths for the headers files of your WSL installation. In my case I add the following option:
"includePath": [
"C:\\Users\\<username>\\AppData\\Local\\Packages\\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\\LocalState\\rootfs\\usr\\include\\linux",
"C:\\Users\\<usernname>\\AppData\\Local\\Packages\\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\\LocalState\\rootfs\\usr\\include"
],
The CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
might be different so you should check what contents do you have on your packages folder. It depends on the linux distro and version. I'm using Ubuntu version 16.
@sirbabyface, you should avoid putting the system include paths in the includePath
setting. Use compilerPath
instead and point it to /usr/bin/gcc
so the extension can set the correct system include path and defines. (the extension will understand linux paths when you set the compilerPath
in this way).
You can use wslconfig.exe to select which distro is the active one.
Most helpful comment
Have you seen this documentation?