Skip to content

Commit 136091e

Browse files
authored
Updates to MinGW documentation (#1844)
* documentation update for mingw
1 parent 91e4f64 commit 136091e

File tree

1 file changed

+43
-10
lines changed

1 file changed

+43
-10
lines changed

Documentation/LanguageServer/MinGW.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,49 @@
11
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.
22

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:
46

57
```json
68
{
79
"configurations": [
810
{
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",
1047
"intelliSenseMode": "clang-x64",
1148
"includePath": [
1249
"${workspaceRoot}",
@@ -19,7 +56,6 @@ Note that you may have to change the MinGW version number to match what you have
1956
],
2057
"defines": [
2158
"_DEBUG",
22-
"UNICODE",
2359
"__GNUC__=6",
2460
"__cdecl=__attribute__((__cdecl__))"
2561
],
@@ -28,6 +64,7 @@ Note that you may have to change the MinGW version number to match what you have
2864
"C:/MinGW/lib/gcc/mingw32/6.3.0/include",
2965
"C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed",
3066
"C:/MinGW/include/*"
67+
"${workspaceRoot}",
3168
],
3269
"limitSymbolsToIncludedHeaders": true,
3370
"databaseFilename": ""
@@ -37,15 +74,15 @@ Note that you may have to change the MinGW version number to match what you have
3774
}
3875
```
3976

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).
4178

4279
For C projects, simply remove the C++ lines:
4380

4481
```json
4582
{
4683
"configurations": [
4784
{
48-
"name": "Win32",
85+
"name": "MinGW",
4986
"intelliSenseMode": "clang-x64",
5087
"includePath": [
5188
"${workspaceRoot}",
@@ -55,7 +92,6 @@ For C projects, simply remove the C++ lines:
5592
],
5693
"defines": [
5794
"_DEBUG",
58-
"UNICODE",
5995
"__GNUC__=6",
6096
"__cdecl=__attribute__((__cdecl__))"
6197
],
@@ -64,6 +100,7 @@ For C projects, simply remove the C++ lines:
64100
"C:/MinGW/lib/gcc/mingw32/6.3.0/include",
65101
"C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed",
66102
"C:/MinGW/include/*"
103+
"${workspaceRoot}",
67104
],
68105
"limitSymbolsToIncludedHeaders": true,
69106
"databaseFilename": ""
@@ -72,7 +109,3 @@ For C projects, simply remove the C++ lines:
72109
]
73110
}
74111
```
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

Comments
 (0)