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
Open Folder projects that don't use CMake can store project configuration settings for IntelliSense in a *CppProperties.json* file. (CMake projects use a [CMakeSettings.json](customize-cmake-settings.md) file.) A configuration consists of name/value pairs and defines #include paths, compiler switches, and other parameters. For more information about how to add configurations in an Open Folder project, see [Open Folder projects for C++](open-folder-projects-cpp.md). The following sections summarize the various settings. For a complete description of the schema, navigate to *CppProperties_schema.json*, whose full path is given at the top of the code editor when *CppProperties.json* is open.
9
+
Open Folder projects that don't use CMake can store project configuration settings for IntelliSense in a *`CppProperties.json`* file. (CMake projects use a [`CMakeSettings.json`](customize-cmake-settings.md) file.) A configuration consists of name/value pairs and defines #include paths, compiler switches, and other parameters. For more information about how to add configurations in an Open Folder project, see [Open Folder projects for C++](open-folder-projects-cpp.md). The following sections summarize the various settings. For a complete description of the schema, navigate to *CppProperties_schema.json*, whose full path is given at the top of the code editor when *`CppProperties.json`* is open.
10
10
11
11
## Configuration properties
12
12
13
13
A configuration may have any of the following properties:
14
14
15
-
|Name|Description|
16
-
|-|-|
17
-
|`inheritEnvironments`| Specifies which environments apply to this configuration.|
18
-
|`name`|The configuration name that will appear in the C++ configuration dropdown|
19
-
|`includePath`|A comma-separated list of folders that should be specified in the include path (maps to /I for most compilers)|
20
-
|`defines`|The list of macros that should be defined (maps to /D for most compilers)|
21
-
|`compilerSwitches`|One or more additional switches that can influence IntelliSense behavior|
22
-
|`forcedInclude`|Header to be automatically included in every compilation unit (maps to /FI for MSVC or -include for clang)|
23
-
|`undefines`|The list of macros to be undefined (maps to /U for MSVC)|
24
-
|`intelliSenseMode`|The IntelliSense engine to be used. You can specify one of the predefined architecture-specific variants for MSVC, gcc, or Clang.|
25
-
|`environments`|User-defined sets of variables that behave like environment variables in a command prompt and are accessed with the ${env.\<VARIABLE>} macro.|
15
+
|Name|Description|
16
+
|--|--|
17
+
|`inheritEnvironments`| Specifies which environments apply to this configuration.|
18
+
|`name`|The configuration name that will appear in the C++ configuration dropdown|
19
+
|`includePath`|A comma-separated list of folders that should be specified in the include path (maps to `/I` for most compilers)|
20
+
|`defines`|The list of macros that should be defined (maps to `/D` for most compilers)|
21
+
|`compilerSwitches`|One or more additional switches that can influence IntelliSense behavior|
22
+
|`forcedInclude`|Header to be automatically included in every compilation unit (maps to `/FI` for MSVC or `-include` for clang)|
23
+
|`undefines`|The list of macros to be undefined (maps to `/U` for MSVC)|
24
+
|`intelliSenseMode`|The IntelliSense engine to be used. You can specify one of the predefined architecture-specific variants for MSVC, gcc, or Clang.|
25
+
|`environments`|User-defined sets of variables that behave like environment variables in a command prompt and are accessed with the `${env.VARIABLE}` macro.|
26
26
27
27
### intelliSenseMode values
28
28
29
29
The code editor shows the available options when you start to type:
30
30
31
31

32
32
33
-
These are the supported values:
34
-
35
-
- windows-msvc-x86
36
-
- windows-msvc-x64
37
-
- windows-msvc-arm
38
-
- windows-msvc-arm64
39
-
- android-clang-x86
40
-
- android-clang-x64
41
-
- android-clang-arm
42
-
- android-clang-arm64
43
-
- ios-clang-x86
44
-
- ios-clang-x64
45
-
- ios-clang-arm
46
-
- ios-clang-arm64
47
-
- windows-clang-x86
48
-
- windows-clang-x64
49
-
- windows-clang-arm
50
-
- windows-clang-arm64
51
-
- linux-gcc-x86
52
-
- linux-gcc-x64
53
-
- linux-gcc-arm
33
+
This list shows the supported values:
34
+
35
+
-`windows-msvc-x86`
36
+
-`windows-msvc-x64`
37
+
-`windows-msvc-arm`
38
+
-`windows-msvc-arm64`
39
+
-`android-clang-x86`
40
+
-`android-clang-x64`
41
+
-`android-clang-arm`
42
+
-`android-clang-arm64`
43
+
-`ios-clang-x86`
44
+
-`ios-clang-x64`
45
+
-`ios-clang-arm`
46
+
-`ios-clang-arm64`
47
+
-`windows-clang-x86`
48
+
-`windows-clang-x64`
49
+
-`windows-clang-arm`
50
+
-`windows-clang-arm64`
51
+
-`linux-gcc-x86`
52
+
-`linux-gcc-x64`
53
+
-`linux-gcc-arm`
54
54
55
55
Note: The values `msvc-x86` and `msvc-x64` are supported for legacy reasons only. Use the `windows-msvc-*` variants instead.
56
56
57
57
## Pre-defined Environments
58
58
59
-
Visual Studio provides the following predefined environments for Microsoft C++ which map to the corresponding Developer Command Prompt. When you inherit one of these environments, you can refer to any of the environment variables by using the global property `env` with this macro syntax: ${env.\<VARIABLE>}.
59
+
Visual Studio provides the following predefined environments for Microsoft C++ which map to the corresponding Developer Command Prompt. When you inherit one of these environments, you can refer to any of the environment variables by using the global property `env` with this macro syntax: `${env.VARIABLE}`.
60
60
61
-
|Variable Name|Description|
62
-
|-----------|-----------------|
63
-
|vsdev|The default Visual Studio environment|
64
-
|msvc_x86|Compile for x86 using x86 tools|
65
-
|msvc_x64|Compile for AMD64 using 64-bit tools|
66
-
|msvc_arm|Compile for ARM using x86 tools|
67
-
|msvc_arm64|Compile for ARM64 using x86 tools|
68
-
|msvc_x86_x64|Compile for AMD64 using x86 tools|
69
-
|msvc_arm_x64|Compile for ARM using 64-bit tools|
70
-
|msvc_arm64_x64|Compile for ARM64 using 64-bit tools|
61
+
|Variable Name|Description|
62
+
|--|--|
63
+
|`vsdev`|The default Visual Studio environment|
64
+
|`msvc_x86`|Compile for x86 using x86 tools|
65
+
|`msvc_x64`|Compile for AMD64 using 64-bit tools|
66
+
|`msvc_arm`|Compile for ARM using x86 tools|
67
+
|`msvc_arm64`|Compile for ARM64 using x86 tools|
68
+
|`msvc_x86_x64`|Compile for AMD64 using x86 tools|
69
+
|`msvc_arm_x64`|Compile for ARM using 64-bit tools|
70
+
|`msvc_arm64_x64`|Compile for ARM64 using 64-bit tools|
71
71
72
72
When the Linux workload is installed, the following environments are available for remotely targeting Linux and WSL:
You can optionally use the `environments` property to define sets of variables in *CppProperties.json* either globally or per-configuration. These variables behave like environment variables in the context of an Open Folder project and can be accessed with the ${env.\<VARIABLE>} syntax from *tasks.vs.json* and *launch.vs.json* after they are defined here. However, they are not necessarily set as actual environment variables in any command prompt that Visual Studio uses internally.
82
+
You can optionally use the `environments` property to define sets of variables in *`CppProperties.json`* either globally or per-configuration. These variables behave like environment variables in the context of an Open Folder project. You can access them with the `${env.VARIABLE}` syntax from *`tasks.vs.json`* and *`launch.vs.json`* after they're defined here. However, they aren't necessarily set as actual environment variables in any command prompt that Visual Studio uses internally.
83
83
84
-
**Visual Studio 2019 version 16.4 and later:** Configuration-specific variables defined in *CppProperties.json* are automatically picked up by debug targets and tasks without the need to set `inheritEnvironments`. Debug targets are launched automatically with the environment you specify in *CppProperties.json*.
84
+
**Visual Studio 2019 version 16.4 and later:** Configuration-specific variables defined in *`CppProperties.json`* are automatically picked up by debug targets and tasks without the need to set `inheritEnvironments`. Debug targets are launched automatically with the environment you specify in *`CppProperties.json`*.
85
85
86
86
**Visual Studio 2019 version 16.3 and earlier:** When you consume an environment, then you have to specify it in the `inheritsEnvironments` property even if the environment is defined as part of the same configuration; the `environment` property specifies the name of the environment. The following example shows a sample configuration for enabling IntelliSense for GCC in an MSYS2 installation. Note how the configuration both defines and inherits the `mingw_64` environment, and how the `includePath` property can access the `INCLUDE` variable.
87
87
@@ -113,21 +113,21 @@ You can optionally use the `environments` property to define sets of variables i
113
113
]
114
114
```
115
115
116
-
When you define an **environments** property inside a configuration, it overrides any global variables of the same name.
116
+
When you define an `"environments"` property inside a configuration, it overrides any global variables that have the same names.
117
117
118
118
## Built-in macros
119
119
120
-
You have access to the following built-in macros inside *CppProperties.json*:
120
+
You have access to the following built-in macros inside *`CppProperties.json`*:
121
121
122
-
|Macro|Description|
123
-
|-|-|
124
-
|`${workspaceRoot}`| The full path to the workspace folder|
125
-
|`${projectRoot}`| The full path to the folder where *CppProperties.json* is placed|
126
-
|`${env.vsInstallDir}`| The full path to the folder where the running instance of Visual Studio is installed|
122
+
|Macro|Description|
123
+
|--|--|
124
+
|`${workspaceRoot}`| The full path to the workspace folder|
125
+
|`${projectRoot}`| The full path to the folder where *`CppProperties.json`* is placed|
126
+
|`${env.vsInstallDir}`| The full path to the folder where the running instance of Visual Studio is installed|
127
127
128
128
### Example
129
129
130
-
If your project has an include folder and also includes *windows.h* and other common headers from the Windows SDK, you may want to update your *CppProperties.json* configuration file with the following includes:
130
+
If your project has an include folder and also includes `*windows.h`* and other common headers from the Windows SDK, you may want to update your *`CppProperties.json`* configuration file with the following includes:
131
131
132
132
```json
133
133
{
@@ -136,28 +136,28 @@ If your project has an include folder and also includes *windows.h* and other co
> `%WindowsSdkDir%` and `%VCToolsInstallDir%` are not set as global environment variables so make sure you start devenv.exe from a Developer Command Prompt that defines these variables. (Type "developer" in the Windows Start Menu.)
152
+
> [!NOTE]
153
+
> `%WindowsSdkDir%` and `%VCToolsInstallDir%` are not set as global environment variables. Make sure you start *`devenv.exe`* from a Developer Command Prompt that defines these variables. (Type "developer" in the Windows Start Menu to find a Developer Command Prompt shortcut.)
154
154
155
155
## Troubleshoot IntelliSense errors
156
156
157
-
If you are not seeing the IntelliSense that you expect, you can troubleshoot by going to **Tools** > **Options** > **Text Editor** > **C/C++** > **Advanced** and setting **Enable Logging** to **`true`**. To start with, try setting **Logging Level** to 5, and **Logging Filters** to 8.
157
+
If you aren't seeing the IntelliSense that you expect, you can troubleshoot by going to **Tools** > **Options** > **Text Editor** > **C/C++** > **Advanced** and setting **Enable Logging** to **`true`**. To start with, try setting **Logging Level** to 5, and **Logging Filters** to 8.
158
158
159
159

160
160
161
-
Output is piped to the **Output Window** and is visible when you choose **Show Output From: Visual C++ Log**. The output contains, among other things, the list of actual include paths that IntelliSense is trying to use. If the paths do not match the ones in *CppProperties.json*, try closing the folder and deleting the *.vs* sub-folder which contains cached browsing data.
161
+
Output is piped to the **Output Window** and is visible when you choose **Show Output From: Visual C++ Log**. The output contains, among other things, the list of actual include paths that IntelliSense is trying to use. If the paths don't match the ones in *`CppProperties.json`*, try closing the folder and deleting the *`.vs`* subfolder that contains cached browsing data.
162
162
163
-
To troubleshoot IntelliSense errors caused by missing include paths, open the **Error List** and filter its output to "IntelliSense only" and error code E1696 "cannot open source file ...".
163
+
To troubleshoot IntelliSense errors caused by missing include paths, open the **Error List**tab, and then filter its output to "IntelliSense only" and error code E1696 "cannot open source file ...".
0 commit comments