Skip to content

Commit 8979a6e

Browse files
authored
Create Windows Subsystem for Linux.md
1 parent 2001e92 commit 8979a6e

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
For developers using the Windows Subsystem for Linux, we recommend you start with the following **c_cpp_properties.json** template. Select "C/Cpp: Edit Configurations" from the command palette to create this file if you haven't already.
2+
3+
```
4+
{
5+
"name": "WSL",
6+
"intelliSenseMode": "clang-x64",
7+
"includePath": [
8+
"${workspaceRoot}",
9+
"${localappdata}/lxss/rootfs/usr/include/c++/5",
10+
"${localappdata}/lxss/rootfs/usr/include/x86_64-linux-gnu/c++/5",
11+
"${localappdata}/lxss/rootfs/usr/include/c++/5/backward",
12+
"${localappdata}/lxss/rootfs/usr/lib/gcc/x86_64-linux-gnu/5/include",
13+
"${localappdata}/lxss/rootfs/usr/local/include",
14+
"${localappdata}/lxss/rootfs/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed",
15+
"${localappdata}/lxss/rootfs/usr/include/x86_64-linux-gnu",
16+
"${localappdata}/lxss/rootfs/usr/include"
17+
],
18+
"defines": [
19+
"__linux__",
20+
"__x86_64__"
21+
],
22+
"browse": {
23+
"path": [
24+
"${localappdata}/lxss/rootfs/usr/include/c++/5",
25+
"${localappdata}/lxss/rootfs/usr/include/x86_64-linux-gnu/c++/5",
26+
"${localappdata}/lxss/rootfs/usr/lib/gcc/x86_64-linux-gnu/5/include",
27+
"${localappdata}/lxss/rootfs/usr/local/include",
28+
"${localappdata}/lxss/rootfs/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed",
29+
"${localappdata}/lxss/rootfs/usr/include/x86_64-linux-gnu",
30+
"${localappdata}/lxss/rootfs/usr/include/*"
31+
],
32+
"limitSymbolsToIncludedHeaders": true,
33+
"databaseFilename": ""
34+
}
35+
}
36+
37+
```
38+
39+
The `includePath` above includes the system header paths that gcc uses for C++ projects and matches the output of `gcc -v -E -x c++ - < /dev/null`. The intelliSenseMode should be set to **"clang-x64"** to get WSL projects to work properly with IntelliSense.
40+
41+
For C projects, simply remove the c++ lines:
42+
43+
```
44+
{
45+
"name": "WSL",
46+
"intelliSenseMode": "clang-x64",
47+
"includePath": [
48+
"${workspaceRoot}",
49+
"${localappdata}/lxss/rootfs/usr/lib/gcc/x86_64-linux-gnu/5/include",
50+
"${localappdata}/lxss/rootfs/usr/local/include",
51+
"${localappdata}/lxss/rootfs/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed",
52+
"${localappdata}/lxss/rootfs/usr/include/x86_64-linux-gnu",
53+
"${localappdata}/lxss/rootfs/usr/include"
54+
],
55+
"defines": [
56+
"__linux__",
57+
"__x86_64__"
58+
],
59+
"browse": {
60+
"path": [
61+
"${localappdata}/lxss/rootfs/usr/lib/gcc/x86_64-linux-gnu/5/include",
62+
"${localappdata}/lxss/rootfs/usr/local/include",
63+
"${localappdata}/lxss/rootfs/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed",
64+
"${localappdata}/lxss/rootfs/usr/include/x86_64-linux-gnu",
65+
"${localappdata}/lxss/rootfs/usr/include/*"
66+
],
67+
"limitSymbolsToIncludedHeaders": true,
68+
"databaseFilename": ""
69+
}
70+
}
71+
```
72+
73+
With these configurations, you should be all set up to use the new IntelliSense engine for linting, memberlist autocomplete, and quick info (tooltips). Add `"C_Cpp.intelliSenseEngine": "Default"` to your **settings.json** file to try out the new IntelliSense engine.
74+
75+
And remember to [heed the warnings of the Windows team about not creating or editing Linux files from a Windows app](https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/)!

0 commit comments

Comments
 (0)