You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation/LanguageServer/MinGW.md
+43-10Lines changed: 43 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,49 @@
1
1
For developers using MinGW on Windows, 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
2
3
-
Note that you may have to change the MinGW version number to match what you have installed. Eg. `C:/MinGW/lib/gcc/mingw32/5.3.0/` instead of `C:/MinGW/lib/gcc/mingw32/6.3.0/`.
3
+
## With extension version 0.16.1 and higher:
4
+
5
+
Starting with version 0.16.1, if you set the `compilerPath` property and change `intelliSenseMode` to `clang-x64`, you no longer need to copy the system include path or defines to `includePath` and `defines` to enable IntelliSense to work properly. However, `browse.path` still needs to be updated manually to add the system include paths to enable code browsing for system headers. For example:
4
6
5
7
```json
6
8
{
7
9
"configurations": [
8
10
{
9
-
"name": "Win32",
11
+
"name": "MinGW",
12
+
"intelliSenseMode": "clang-x64",
13
+
"compilerPath": "C:/MinGW/bin/gcc.exe",
14
+
"includePath": [
15
+
"${workspaceRoot}",
16
+
],
17
+
"defines": [
18
+
"_DEBUG"
19
+
],
20
+
"browse": {
21
+
"path": [
22
+
"C:/MinGW/lib/gcc/mingw32/6.3.0/include",
23
+
"C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed",
24
+
"C:/MinGW/include/*"
25
+
"${workspaceRoot}",
26
+
],
27
+
"limitSymbolsToIncludedHeaders": true,
28
+
"databaseFilename": ""
29
+
}
30
+
}
31
+
],
32
+
"version": 3
33
+
}
34
+
```
35
+
36
+
Note that the `browse.path` setting is not automatically updated at this time and you may have to change the MinGW version number to match what you have installed. If you are using a different MinGW distribution, the values for `compilerPath` and `browse.path` will likely be different than what is written here.
37
+
38
+
## With extension version 0.16.0 and earlier:
39
+
40
+
In earlier versions of the extension, the `includePath` and a some system defines need to be set in order for IntelliSense to work properly. Note that you may have to change the MinGW version number to match what you have installed. Eg. `C:/MinGW/lib/gcc/mingw32/5.3.0/` instead of `C:/MinGW/lib/gcc/mingw32/6.3.0/`.
41
+
42
+
```json
43
+
{
44
+
"configurations": [
45
+
{
46
+
"name": "MinGW",
10
47
"intelliSenseMode": "clang-x64",
11
48
"includePath": [
12
49
"${workspaceRoot}",
@@ -19,7 +56,6 @@ Note that you may have to change the MinGW version number to match what you have
19
56
],
20
57
"defines": [
21
58
"_DEBUG",
22
-
"UNICODE",
23
59
"__GNUC__=6",
24
60
"__cdecl=__attribute__((__cdecl__))"
25
61
],
@@ -28,6 +64,7 @@ Note that you may have to change the MinGW version number to match what you have
28
64
"C:/MinGW/lib/gcc/mingw32/6.3.0/include",
29
65
"C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed",
30
66
"C:/MinGW/include/*"
67
+
"${workspaceRoot}",
31
68
],
32
69
"limitSymbolsToIncludedHeaders": true,
33
70
"databaseFilename": ""
@@ -37,15 +74,15 @@ Note that you may have to change the MinGW version number to match what you have
37
74
}
38
75
```
39
76
40
-
The `includePath` above includes the system header paths that gcc uses in version 6.3.0 for C++ projects and matches the output of `gcc -v -E -x c++ -`. The `intelliSenseMode` should be set to **"clang-x64"** to get MinGW projects to work properly with IntelliSense. The `__GNUC__=#` define should match the major version of the toolchain in your installation (6 in this example).
77
+
The `includePath` above includes the system header paths that gcc uses in version 6.3.0 for C++ projects and matches the output of `"gcc -v -E -x c++ nul"`. The `intelliSenseMode` should be set to **"clang-x64"** to get MinGW projects to work properly with IntelliSense. The `__GNUC__=#` define should match the major version of the toolchain in your installation (6 in this example).
41
78
42
79
For C projects, simply remove the C++ lines:
43
80
44
81
```json
45
82
{
46
83
"configurations": [
47
84
{
48
-
"name": "Win32",
85
+
"name": "MinGW",
49
86
"intelliSenseMode": "clang-x64",
50
87
"includePath": [
51
88
"${workspaceRoot}",
@@ -55,7 +92,6 @@ For C projects, simply remove the C++ lines:
55
92
],
56
93
"defines": [
57
94
"_DEBUG",
58
-
"UNICODE",
59
95
"__GNUC__=6",
60
96
"__cdecl=__attribute__((__cdecl__))"
61
97
],
@@ -64,6 +100,7 @@ For C projects, simply remove the C++ lines:
64
100
"C:/MinGW/lib/gcc/mingw32/6.3.0/include",
65
101
"C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed",
66
102
"C:/MinGW/include/*"
103
+
"${workspaceRoot}",
67
104
],
68
105
"limitSymbolsToIncludedHeaders": true,
69
106
"databaseFilename": ""
@@ -72,7 +109,3 @@ For C projects, simply remove the C++ lines:
72
109
]
73
110
}
74
111
```
75
-
76
-
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.
77
-
78
-
UPDATE: Starting with 0.16.1, setting the `compilerPath` property to the full path to your MinGW compiler should set all the compiler includes and defines automatically, but the `browse.path` setting still needs to be set manually.
0 commit comments