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
Use the *launch.vs.json* file to configure debugging parameters. To create the file. right-click on an executable file in **Solution Explorer** and choose **Debug and Launch Settings**. Choose the option that most closely matches your project and then use the following properties to modify the configuration as needed. For more information on debugging CMake projects, see [Configure CMake debugging sessions](./configure-cmake-debugging-sessions.md).
9
+
Starting in Visual Studio 2017, you can open code from nearly any type of directory-based project into Visual Studio without the need for a solution or project file. When there's no project or solution file, you can specify custom build tasks and launch parameters through JSON configuration files. This article describes the `launch.vs.json` file, which specifies debugging parameters. See [Develop code in Visual Studio without projects or solutions](https://docs.microsoft.com/visualstudio/ide/develop-code-in-visual-studio-without-projects-or-solutions) for more information about the "Open Folder" feature.
10
+
11
+
To create the file, right-click on an executable file in **Solution Explorer** and choose **Debug and Launch Settings**. Choose the option that most closely matches your project and then use the following properties to modify the configuration as needed. For more information on debugging CMake projects, see [Configure CMake debugging sessions](./configure-cmake-debugging-sessions.md).
10
12
11
13
## Default properties
12
14
@@ -56,6 +58,49 @@ Use the *launch.vs.json* file to configure debugging parameters. To create the f
56
58
externalConsole|boolean|If true, a console is launched for the debuggee. If **`false`**, no console is launched. The default for this setting is **`false`**. This option is ignored in some cases for technical reasons.|
57
59
|`pipeTransport`|string|When present, this tells the debugger to connect to a remote computer using another executable as a pipe that will relay standard input/output between Visual Studio and the MI-enabled debugger (such as gdb). Allowed values: one or more [Pipe Transport Options](#pipe_transport_options).|
58
60
61
+
## debugInfo macros
62
+
63
+
The following macros provide information about the debugging environment. They're useful for customizing the launch of your app for debugging.
64
+
65
+
|Macro |Description |Example |
66
+
|---|---|---|
67
+
|`addressSanitizerRuntimeFlags`| Runtime flags used to customize behavior of the address sanitizer. Used to set the environment variable `"ASAN_OPTIONS"`. |`"env": {"ASAN_OPTIONS": "${addressSanitizerRuntimeFlags}:anotherFlag=true"`} |
68
+
|`defaultWorkingDirectory`| Set to the directory part of `"fullTargetPath"`. If the CMake variable `VS_DEBUGGER_WORKING_DIRECTORY` is defined, then `defaultWorkingDirectory` is set to that value, instead. |`"cwd":"${debugInfo.defaultWorkingDirectory}"`|
69
+
|`fullTargetPath`| The full path to the binary being debugged. |`"program": "${debugInfo.fullTargetPath}"`|
70
+
|`linuxNatvisPath`| The full windows path to the VS linux `.natvis` file. Usually appears as the value `"visualizerFile"`. |
71
+
|`parentProcessId`| The process ID for the current Visual Studio instance. Used as a parameter to shellexec. | See pipeTransport example below. |
72
+
|`remoteMachineId`| A unique, numeric identifier for the connection to the remote machine. Used as a parameter to shellexec. | See pipeTransport example below. |
73
+
|`remoteWorkspaceRoot`| Linux path to the remote copy of the workspace. | Specify file locations on the remote machine. For example: `"args": ["${debugInfo.remoteWorkspaceRoot}/Data/MyInputFile.dat"]`|
74
+
|`resolvedRemoteMachineName`| The name of the target remote machine. |`"targetMachine"` value in a deployment directive ||
75
+
|`shellexecPath`| The path to the shellexec program that Visual Studio is using to manage the remote machine connection. | See pipeTransport example below |
76
+
|`tty`| gdb will redirect input and output to this device for the program being debugged. Used as a parameter to gdb (-tty). | See pipeTransport example below. |
77
+
|`windowsSubsystemPath`| The full path to the Windows Subsystem for Linux instance. ||
78
+
79
+
The pipeTransport example below shows how to use some of the `debugInfo` macros defined above:
80
+
81
+
```json
82
+
"pipeTransport": {
83
+
"pipeProgram": "${debugInfo.shellexecPath}",
84
+
"pipeArgs": [
85
+
"/s",
86
+
"${debugInfo.remoteMachineId}",
87
+
"/p",
88
+
"${debugInfo.parentProcessId}",
89
+
"/c",
90
+
"${debuggerCommand}",
91
+
"--tty=${debugInfo.tty}"
92
+
],
93
+
"pipeCmd": [
94
+
"/s",
95
+
"${debugInfo.remoteMachineId}",
96
+
"/p",
97
+
"${debugInfo.parentProcessId}",
98
+
"/c",
99
+
"${debuggerCommand}"
100
+
]
101
+
}
102
+
```
103
+
59
104
## <aname="remote_deploy_debug"></a> C++ Windows remote debug and deploy properties
60
105
61
106
Used when debugging and deploying an app on a remote machine.
Copy file name to clipboardExpand all lines: docs/build/reference/std-specify-language-standard-version.md
+29-34Lines changed: 29 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -22,13 +22,12 @@ The **`/std`** options are available in Visual Studio 2017 and later. They're us
22
22
23
23
### C++ standards support
24
24
25
-
The **`/std`** option in effect during a C++ compilation can be detected by use of the [\_MSVC\_LANG](../../preprocessor/predefined-macros.md) preprocessor macro. For more information, see [Preprocessor Macros](../../preprocessor/predefined-macros.md).
25
+
The **`/std`** option in effect during a C++ compilation can be detected by use of the [`_MSVC_LANG`](../../preprocessor/predefined-macros.md) preprocessor macro. For more information, see [Preprocessor Macros](../../preprocessor/predefined-macros.md).
26
26
27
-
**`/std:c++14`**
27
+
**`/std:c++14`**\
28
+
The **`/std:c++14`** option enables C++14 standard-specific features implemented by the MSVC compiler. This option is the default for code compiled as C++. It's available starting in Visual Studio 2015 Update 3.
28
29
29
-
Enables C++14 standard-specific features implemented by the MSVC compiler. This option is the default for code compiled as C++. Available starting with Visual Studio 2015 Update 3. Enables C++14 standard-specific features implemented by the MSVC compiler.
30
-
31
-
This option disables compiler and standard library support for features that are changed or new in more recent versions of the language standard. It doesn't disable some C++17 features already implemented in previous releases of the MSVC compiler. For more information, see [Microsoft C/C++ language conformance](../../overview/visual-cpp-language-conformance.md). It indicates which C++14 and C++17 features are enabled when you specify **`/std:c++14`**.
30
+
This option disables compiler and standard library support for features that are changed or new in more recent versions of the language standard. However, it doesn't disable some C++17 features already implemented in previous releases of the MSVC compiler. For more information, see [Microsoft C/C++ language conformance](../../overview/visual-cpp-language-conformance.md). The tables indicate which C++17 features are enabled when you specify **`/std:c++14`**.
32
31
33
32
The following features remain enabled when the **`/std:c++14`** option is specified to avoid breaking changes for users who have already taken dependencies on the features available in or before Visual Studio 2015 Update 2:
34
33
@@ -38,69 +37,65 @@ The following features remain enabled when the **`/std:c++14`** option is specif
38
37
-[Attributes for namespaces and enumerators](https://wg21.link/n4266)
39
38
-[u8 character literals](https://wg21.link/n4267)
40
39
41
-
**`/std:c++17`**
42
-
43
-
Enable C++17 standard-specific features and behavior. Enables the full set of C++17 features implemented by the MSVC compiler. This option disables compiler and standard library support for features that are new or changed after C++17. That includes post-C++17 changes in versions of the Working Draft and defect updates of the C++ Standard. Available starting in Visual Studio version 15.3
40
+
**`/std:c++17`**\
41
+
The **`/std:c++17`** option enables C++17 standard-specific features and behavior. It enables the full set of C++17 features implemented by the MSVC compiler. This option disables compiler and standard library support for features that are new or changed after C++17. It specifically disables post-C++17 changes in the C++ Standard and versions of the Working Draft. It does not disable retroactive defect updates of the C++ Standard. This option is available starting in Visual Studio 2017 version 15.3.
44
42
45
43
Depending on the MSVC compiler version or update level, C++17 features may not be fully implemented or fully conforming when you specify the **`/std:c++17`** options. For an overview of C++ language conformance in Visual C++ by release version, see [Microsoft C/C++ language conformance](../../overview/visual-cpp-language-conformance.md).
46
44
47
-
**`/std:c++latest`**
48
-
49
-
Enable all currently implemented compiler and standard library features proposed for the next draft standard. Available starting with Visual Studio 2015 Update 3
45
+
**`/std:c++latest`**\
46
+
The **`/std:c++latest`** option enables all currently implemented compiler and standard library features proposed for the next draft standard, as well as some experimental features. This option is available starting in Visual Studio 2015 Update 3.
50
47
51
-
Enables the post-C++17 language and library features currently implemented in the compiler and libraries. These features may include changes to the latest Working Draft standard, defect updates, and experimental proposals for the standard.
48
+
As of Visual Studio 2019 version 16.10, **`/std:c++latest`** is required to enable all the compiler and standard library features of C++20. There will be a **`/std:c++20`** option that does not include later proposed or experimental features in a future version of Visual Studio.
52
49
53
-
For a list of supported language and library features, see [What's New for Visual C++](../../overview/what-s-new-for-visual-cpp-in-visual-studio.md).
50
+
For a list of supported language and library features, see [What's New for C++ in Visual Studio](../../overview/what-s-new-for-visual-cpp-in-visual-studio.md).
54
51
55
-
This option doesn't enable features guarded by the **`/experimental`** switch, but may be required to enable them.
52
+
The **`/std:c++latest`** option doesn't enable features guarded by the **`/experimental`** switch, but may be required to enable them.
56
53
57
54
> [!NOTE]
58
55
> The compiler and library features enabled by **`/std:c++latest`** may appear in a future C++ standard, as well as approved C++20 features. Features that have not been approved are subject to breaking changes or removal without notice and are provided on an as-is basis.
59
56
60
57
### C standards support
61
58
62
-
By default, when code is compiled as C, the MSVC compiler doesn't conform to a particular C standard. It implements ANSI C89 with several Microsoft extensions, some of which are part of ISO C99. Some Microsoft extensions can be disabled by using the [`/Za`](za-ze-disable-language-extensions.md) compiler option, but others remain in effect. It isn't possible to specify strict C89 conformance.
63
-
64
-
**`/std:c11`**
65
-
66
-
Enable ISO C11 conformance. Available starting in Visual Studio 2019 version 16.8.
59
+
You can invoke the Microsoft C compiler by using the [`/TC` or `/Tc`](tc-tp-tc-tp-specify-source-file-type.md) compiler option. It's used by default for code that has a *`.c`* file extension, unless overridden by a **`/TP`** or **`/Tp`** option. The default C compiler (that is, the compiler when **`/std:c11`** or **`/std:c17`** isn't specified) implements ANSI C89, but includes several Microsoft extensions, some of which are part of ISO C99. Some Microsoft extensions to C89 can be disabled by using the [`/Za`](za-ze-disable-language-extensions.md) compiler option, but others remain in effect. It isn't possible to specify strict C89 conformance. The compiler doesn't implement several required features of C99, so it isn't possible to specify C99 conformance, either.
67
60
68
-
**`/std:c17`**
61
+
**`/std:c11`**\
62
+
The **`/std:c11`** option enables ISO C11 conformance. It's available starting in Visual Studio 2019 version 16.8.
69
63
70
-
Enable ISO C17 conformance. Available starting in Visual Studio 2019 version 16.8.
64
+
**`/std:c17`**\
65
+
The **`/std:c17`** option enables ISO C17 conformance. It's available starting in Visual Studio 2019 version 16.8.
71
66
72
67
Because the new preprocessor is needed to support these standards, the **`/std:c11`** and **`/std:c17`** compiler options set the [`/Zc:preprocessor`](zc-preprocessor.md) option automatically. If you want to use the traditional (legacy) preprocessor for C11 or C17, you must set the **`/Zc:preprocessor-`** compiler option explicitly. Setting the **`/Zc:preprocessor-`** option may lead to unexpected behavior, and isn't recommended.
73
68
74
69
> [!NOTE]
75
-
> At the time of release, the Windows SDK and UCRT libraries installed by Visual Studio don't support C11 and C17 code ywt. An updated version of the Windows SDK and UCRT is required. For more information and installation instructions, see [Install C11 and C17 support in Visual Studio](../../overview/install-c17-support.md).
70
+
> At the time of release and through Visual Studio 2019 version 16.10, the Windows SDK and UCRT libraries installed by Visual Studio don't yet support C11 and C17 code. An updated version of the Windows SDK and UCRT is required. For more information and installation instructions, see [Install C11 and C17 support in Visual Studio](../../overview/install-c17-support.md).
76
71
77
-
When you specify **`/std:c11`** or **`/std:c17`**, MSVC supports all the features of C11 and C17 required by the standard. (Certain optional features aren't supported.) The compiler options enable support for these functionalities:
72
+
When you specify **`/std:c11`** or **`/std:c17`**, MSVC supports all the features of C11 and C17 required by the standards. The **`/std:c11`** and **`/std:c17`** compiler options enable support for these functionalities:
The IDE uses C settings for IntelliSense and code highlighting when your source files have a *`.c`* file extension, or when you specify the [`/TC`](tc-tp-tc-tp-specify-source-file-type.md) compiler option. Currently, IntelliSense highlighting is only available for keywords, and not the macros introduced by the standard headers.
86
+
The IDE uses C settings for IntelliSense and code highlighting when your source files have a *`.c`* file extension, or when you specify the [`/TC` or `/Tc`](tc-tp-tc-tp-specify-source-file-type.md) compiler option. Currently, IntelliSense in C highlights keywords `_Alignas`, `_Alignof`, `_Noreturn`, and `_Static_assert`, but not the equivalent macros defined in the standard headers: `alignas`, `alignof`, `noreturn`, and `static_assert`.
92
87
93
-
Since C17 is largely a bugfix release of ISO C11, MSVC support for C11 already includes all the relevant defect reports. There are no differences between the C11 and C17 versions except for the `__STDC_VERSION__` macro. It expands to `201112L` for C11, and `201710L` for C17.
88
+
Since C17 is largely a bug-fix release of ISO C11, MSVC support for C11 already includes all the relevant defect reports. There are no differences between the C11 and C17 versions except for the `__STDC_VERSION__` macro. It expands to `201112L` for C11, and `201710L` for C17.
94
89
95
90
The compiler doesn't support most optional features of ISO C11. Several of these optional features of C11 were required features of C99 that MSVC hasn't implemented for architectural reasons. You can use the feature test macros such as `__STDC_NO_VLA__` to detect compiler support levels for individual features. For more information about C-specific predefined macros, see [Predefined macros](../../preprocessor/predefined-macros.md).
96
91
97
-
- There's no conforming multithreading, atomic, or complex number support in the Visual Studio 2019 version 16.8 release.
92
+
- There's no conforming multithreading, atomic, or complex number support.
98
93
99
94
-`aligned_alloc` support is missing, because of the Windows heap implementation. The alternative is to use [`_aligned_malloc`](../../c-runtime-library/reference/aligned-malloc.md).
100
95
101
-
- DR 400 support is currently unimplemented for `realloc`, because this change would break the ABI.
96
+
-[DR 400](http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400) support is currently unimplemented for `realloc`, because this change would break the ABI.
102
97
103
-
- Variable length array (VLA) support isn't planned. VLAs provide attack vectors comparable to `gets()`, which is deprecated and planned for removal.
98
+
- Variable length array (VLA) support isn't planned. VLAs provide attack vectors comparable to [`gets`](../../c-runtime-library/gets-getws.md), which is deprecated and planned for removal.
104
99
105
100
For more information, see the C Standard library features section of [Microsoft C/C++ language conformance](../../overview/visual-cpp-language-conformance.md).
Primary expressions are the building blocks of more complex expressions. They may be constants, identifiers, a [Generic selection](generic_selection.md), or an expression in parentheses.
9
+
Primary expressions are the building blocks of more complex expressions. They may be constants, identifiers, a [Generic selection](generic-selection.md), or an expression in parentheses.
10
10
11
11
## Syntax
12
12
@@ -23,5 +23,5 @@ Primary expressions are the building blocks of more complex expressions. They ma
23
23
24
24
## See also
25
25
26
-
[Generic selection](generic_selection.md)
26
+
[Generic selection](generic-selection.md)
27
27
[Operands and Expressions](../c-language/operands-and-expressions.md)
0 commit comments