Skip to content

Repo sync for protected CLA branch #4299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 18, 2022
Merged
13 changes: 8 additions & 5 deletions docs/build/reference/c-cpp-prop-page.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "C/C++ Project Properties (Visual Studio)"
description: "Reference guide to the Visual Studio Microsoft C/C++ project Property Pages properties."
ms.date: 06/30/2022
ms.date: 11/17/2022
ms.topic: "article"
f1_keywords: ["VC.Project.VCCLCompilerTool.AdditionalModuleDirectories", "VC.Project.VCCLCompilerTool.ScanSourceForModuleDependencies"]
ms.assetid: 16375038-4917-4bd0-9a2a-26343c1708b7
Expand Down Expand Up @@ -36,7 +36,7 @@ Specifies one or more header units to use to resolve names passed to an `import`

When set to **Yes**, the compiler scans all C++ sources, not just module interface and header unit sources, for module and header units dependencies. The build system builds the full dependencies graph, which ensures that all imported modules and header units are built before compiling the files that depend on them. When combined with **Translate Includes to Imports**, any header file that's specified in a [`header-units.json`](header-unit-json-reference.md) file in the same directory as the header file is compiled into a header unit.

Files that have the extension *`.ixx`*, and files that have their **File properties** > **C/C++** > **Compile As** property set to **Compile as C++ Header Unit (/export)**, are always scanned.
Files that have the extension *`.ixx`*, and files that have their **File properties** > **C/C++** > **Compile As** property set to **Compile as C++ Header Unit (/exportHeader)**, are always scanned.

### Translate Includes to Imports

Expand Down Expand Up @@ -485,13 +485,16 @@ Select the default calling convention for your application (can be overridden by

### Compile As

Select compile language option for *`.c`* and *`.cpp`* files. Sets [`/TC`, `/TP`](tc-tp-tc-tp-specify-source-file-type.md).
Select compile language option for source files. Sets [`/TC`, `/TP`](tc-tp-tc-tp-specify-source-file-type.md), [/interface](./interface.md), [`/internalPartition`](./internal-partition.md), or [`/exportHeader`](./module-exportheader.md) options.

#### Choices

- **Default** - Default.
- **Compile as C Code** - Compile as C Code.
- **Compile as C++ Code** - Compile as C++ Code.
- **Compile as C Code ([`/TC`](./tc-tp-tc-tp-specify-source-file-type.md))** - Compile specified source files as C code. By default, files with a *`.c`* extension are compiled as C.
- **Compile as C++ Code ([`/TP`](./tc-tp-tc-tp-specify-source-file-type.md))** - Compile specified source files as C++ code. By default, all source files that don't have a *`.c`*, *`.ixx`*, *`.cppm`*, *`.h`*, or no extension are compiled as C++.
- **Compile as C++ Module Code ([`/interface`](./interface.md))** - Compile specified source files as C++ module code. By default, files with a *`.ixx`* or *`.cppm`* extension are compiled as C++ module code.
- **Compile as C++ Module Internal Partition ([`/internalPartition`](./internal-partition.md))** - Compile specified source files as C++ module internal partition.
- **Compile as C++ Header Unit ([`/exportHeader`](./module-exportheader.md))** - Compile specified source files as C++ header unit. By default, files with a *`.h`* extension or no extension are compiled as header units.

### Disable Specific Warnings

Expand Down
30 changes: 16 additions & 14 deletions docs/build/reference/headername.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "/headerName (Build a header unit from the specified header)"
description: "Use the /headerName compiler option to establish a mapping between a header file and the header unit to build."
ms.date: 04/21/2022
ms.date: 11/16/2022
author: "tylermsft"
ms.author: "twhitney"
f1_keywords: ["/headerName"]
Expand All @@ -23,30 +23,32 @@ The name of a header file that the compiler should compile into a header unit (*

## Remarks

The **`/headerName`** compiler option is available starting in Visual Studio 2019 version 16.10.
The **`/headerName:quote`** and **`/headerName:angle`** compiler options are available starting in Visual Studio 2019 version 16.10.

The **`/headerName`** compiler option, in all its forms, requires the [`/std:c++20`](std-specify-language-standard-version.md) or later compiler option (such as **`/std:c++latest`**).\
If you specify **`/headerName:{quote,angle}`**, you must also specify [`/exportHeader`](module-exportheader.md).
The **`/headerName`** compiler options, in all their forms, require the [`/std:c++20`](std-specify-language-standard-version.md) or later compiler option (such as **`/std:c++latest`**).\
If you specify a **`/headerName`** option, you must also specify [`/exportHeader`](module-exportheader.md).

**`/headerName:quote`** looks up *`header-filename`* using the same rules as `#include "header-name"` and builds it as a header unit (*`.ifc`* file).\
**`/headerName:angle`** looks up *`header-filename`* using the same rules as `#include <header-name>` and builds it as a header unit (*`.ifc`* file).
- **`/headerName:quote`** looks up *`header-filename`* using the same rules as `#include "header-filename"` and builds it as a header unit (*`.ifc`* file).
- **`/headerName:angle`** looks up *`header-filename`* using the same rules as `#include <header-filename>` and builds it as a header unit (*`.ifc`* file).

For more information about the path searching rules for included files in quotes or angle brackets, see [`#include` directive](../../preprocessor/hash-include-directive-c-cpp.md).

### Examples

Given a project that references a header file it defines called `m.h`, the compiler option to compile it into a header unit looks similar to this:
Given a project that references a header file it defines called *`m.h`*, the compiler option to compile it into a header unit looks similar to this example:

```Bash
```bash
cl /std:c++latest /exportHeader /headerName:quote m.h /Fom.h.obj
```

The `/headerName:{quote,angle}` option acts like a flag and doesn't need an argument. The following examples are valid:
The **`/headerName:quote`** and **`/headerName:angle`** options act like a flag and don't need an argument. The following examples are valid:

```Bash
```bash
cl /std:c++latest /exportHeader /headerName:angle /MP /Fo.\ vector iostream algorithm
cl /std:c++latest /exportHeader /headerName:quote /MP /Fo.\ my-utilities.h a/b/my-core.h
```

You can specify multiple `/headerName` options on the same command line, and every argument after that option will be processed with the specified *`header-filename`* lookup rules. The following example processes all the headers as the previous two command line examples in the same way. It looks up the headers using the lookup rules applied as if they had been specified as: `#include <vector>`, `#include "my-utilties.h"`, and `#include "a/b/my-core.h"`:
You can specify multiple **`/headerName`** options on the same command line. Every argument after a **`/headerName`** option is processed with the specified include file lookup rules for quotes or angle brackets until the next **`/headerName`** option. The following example processes all the headers as the previous two command line examples in the same way as before. It looks up the headers using the lookup rules applied as if they had been specified as: `#include <vector>`, `#include <iostream>`, `#include <algorithm>`, `#include "my-utilties.h"`, and `#include "a/b/my-core.h"`:

```bash
cl /std:c++latest /exportHeader /headerName:angle /MP /Fo.\ vector iostream algorithm /headerName:quote my-utilities.h a/b/my-core.h
Expand All @@ -55,15 +57,15 @@ cl /std:c++latest /exportHeader /headerName:angle /MP /Fo.\ vector iostream algo
### To set this compiler option in the Visual Studio development environment

> [!NOTE]
> Users don't typically set this command line option. It's set by the build system.
> You normally shouldn't set this option in the Visual Studio development environment. It's set by the build system.

1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).

1. Set the **Configuration** drop-down to **All Configurations**.
1. Set the **Configuration** drop-down to **All Configurations**. Set the **Platform** drop-down to **All Platforms**.

1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.

1. Modify the **Additional Options** property to add the *`/headerName`* options and arguments. Then, choose **OK** or **Apply** to save your changes.
1. Modify the **Additional Options** property to add the *`/headerName:quote`* or *`/headerName:angle`* options and the header filenames the options apply to. Then, choose **OK** or **Apply** to save your changes.

## See also

Expand Down
14 changes: 13 additions & 1 deletion docs/build/reference/interface.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "/interface"
description: "Use the /interface compiler option to treat the input file as a module interface unit."
ms.date: 04/15/2022
ms.date: 11/16/2022
author: "tylermsft"
ms.author: "twhitney"
f1_keywords: ["/interface", "VC.Project.VCCLCompilerTool.Interface"]
Expand Down Expand Up @@ -32,6 +32,18 @@ This switch must be used in with the [`/TP` (Specify source file type)](tc-tp-tc
**`/interface`** is available in Visual Studio 2019 version 16.10, or later.\
**`/interface`** requires [/std:c++20](std-specify-language-standard-version.md) or later.

### To set this compiler option in the Visual Studio development environment

You normally shouldn't set this option in the Visual Studio development environment unless you use a different extension for your module interface files. By default, the build system applies this option to files that have a *`.ixx`** extension.

1. To apply the **`/interface`** option to a file explicitly in the IDE, select the file in **Solution Explorer**. Right-click to open the context menu and select **Properties** to open the Property Pages dialog.

1. Set the **Configuration** dropdown to **All Configurations**. Set the **Platform** dropdown to **All Platforms**.

1. Open the **Configuration Properties** > **C/C++** > **Advanced** property page.

1. Use the dropdown control to modify the **Compile As** property to **Compile as C++ Module Code (/interface)**. Choose **OK** or **Apply** to save your changes.

## See also

[Overview of modules in C++](../../cpp/modules-cpp.md)\
Expand Down
14 changes: 13 additions & 1 deletion docs/build/reference/internal-partition.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "/internalPartition"
description: "Use the /internalPartition compiler option to treat the input file as an internal partition unit."
ms.date: 06/29/2022
ms.date: 11/16/2022
author: "tylermsft"
ms.author: "twhitney"
f1_keywords: ["/internalPartition", "VC.Project.VCCLCompilerTool.Interface"]
Expand Down Expand Up @@ -50,6 +50,18 @@ This option can't be used with the [`/interface`](interface.md) compiler option.
**`/internalPartition`** is available in Visual Studio 2019 version 16.10, or later.\
**`/internalPartition`** requires [/std:c++20](std-specify-language-standard-version.md) or later.

### To set this compiler option in the Visual Studio development environment

You normally shouldn't set this option in the Visual Studio development environment unless you use a different extension for your partition files. By default, the build system applies this option to files that have a *`.ixx`** extension.

1. To apply the **`/internalPartition`** option to a file explicitly in the IDE, select the file in **Solution Explorer**. Right-click to open the context menu and select **Properties** to open the Property Pages dialog.

1. Set the **Configuration** dropdown to **All Configurations**. Set the **Platform** dropdown to **All Platforms**.

1. Open the **Configuration Properties** > **C/C++** > **Advanced** property page.

1. Use the dropdown control to modify the **Compile As** property to **Compile as C++ Module Internal Partition (/internalPartition)**. Choose **OK** or **Apply** to save your changes.

## See also

[Overview of modules in C++](../../cpp/modules-cpp.md)\
Expand Down
12 changes: 10 additions & 2 deletions docs/build/reference/module-exportheader.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,19 @@ cl . . . /std:c++latest /exportHeader /headerName:quote util/util.h

### To set this compiler option in the Visual Studio development environment

You normally shouldn't set this in the Visual Studio development environment. It is set by the build system.
You normally shouldn't set this option in the Visual Studio development environment unless you use a different extension for your header files. By default, the build system applies this option to compiled files that have a *`.h`* extension, or no extension.

1. To apply the **`/exportHeader`** option to a file explicitly in the IDE, select the file in **Solution Explorer**. Right-click to open the context menu and select **Properties** to open the Property Pages dialog.

1. Set the **Configuration** dropdown to **All Configurations**. Set the **Platform** dropdown to **All Platforms**.

1. Open the **Configuration Properties** > **C/C++** > **Advanced** property page.

1. Use the dropdown control to modify the **Compile As** property to **Compile as C++ Header Unit (/exportHeader)**. Choose **OK** or **Apply** to save your changes.

## See also

[`/headerName (Build a header unit from the specified header)`](headername.md)\
[`/headerName` (Build a header unit from the specified header)](headername.md)\
[`/headerUnit` (Use header unit IFC)](headerunit.md)\
[`/reference` (Use named module IFC)](module-reference.md)\
[`/translateInclude` (Translate include directives into import directives)](translateinclude.md)
58 changes: 29 additions & 29 deletions docs/cpp/com-error-class.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
---
description: "Learn more about: _com_error Class"
title: "_com_error Class"
ms.date: "11/04/2016"
ms.date: 11/17/2022
f1_keywords: ["_com_error"]
helpviewer_keywords: ["_com_error class"]
ms.assetid: 70dafa69-b1fb-4a5c-9249-e857e0793d42
---
# _com_error Class
# `_com_error` class

**Microsoft Specific**

A **_com_error** object represents an exception condition detected by the error-handling wrapper functions in the header files generated from the type library or by one of the COM support classes. The **_com_error** class encapsulates the HRESULT error code and any associated `IErrorInfo Interface` object.
A `_com_error` object represents an exception condition detected by the error-handling wrapper functions in the header files generated from the type library or by one of the COM support classes. The `_com_error` class encapsulates the `HRESULT` error code and any associated `IErrorInfo Interface` object.

### Construction

| Name | Description |
|-|-|
|[_com_error](../cpp/com-error-com-error.md)|Constructs a **_com_error** object.|
|---|---|
| [`_com_error`](../cpp/com-error-com-error.md) | Constructs a `_com_error` object. |

### Operators

| Name | Description |
|-|-|
|[operator =](../cpp/com-error-operator-equal.md)|Assigns an existing **_com_error** object to another.|
|---|---|
| [`operator =`](../cpp/com-error-operator-equal.md) | Assigns an existing `_com_error` object to another. |

### Extractor Functions
### Extractor functions

| Name | Description |
|-|-|
|[Error](../cpp/com-error-error.md)|Retrieves the HRESULT passed to the constructor.|
|[ErrorInfo](../cpp/com-error-errorinfo.md)|Retrieves the `IErrorInfo` object passed to the constructor.|
|[WCode](../cpp/com-error-wcode.md)|Retrieves the 16-bit error code mapped into the encapsulated HRESULT.|
|---|---|
| [`Error`](../cpp/com-error-error.md) | Retrieves the `HRESULT` passed to the constructor. |
| [`ErrorInfo`](../cpp/com-error-errorinfo.md) | Retrieves the `IErrorInfo` object passed to the constructor. |
| [`WCode`](../cpp/com-error-wcode.md) | Retrieves the 16-bit error code mapped into the encapsulated `HRESULT`. |

### IErrorInfo Functions
### `IErrorInfo` functions

| Name | Description |
|-|-|
|[Description](../cpp/com-error-description.md)|Calls `IErrorInfo::GetDescription` function.|
|[HelpContext](../cpp/com-error-helpcontext.md)|Calls `IErrorInfo::GetHelpContext` function.|
|[HelpFile](../cpp/com-error-helpfile.md)|Calls `IErrorInfo::GetHelpFile` function|
|[Source](../cpp/com-error-source.md)|Calls `IErrorInfo::GetSource` function.|
|[GUID](../cpp/com-error-guid.md)|Calls `IErrorInfo::GetGUID` function.|
|---|---|
| [`Description`](../cpp/com-error-description.md) | Calls `IErrorInfo::GetDescription` function. |
| [`HelpContext`](../cpp/com-error-helpcontext.md) | Calls `IErrorInfo::GetHelpContext` function. |
| [`HelpFile`](../cpp/com-error-helpfile.md) | Calls `IErrorInfo::GetHelpFile` function |
| [`Source`](../cpp/com-error-source.md) | Calls `IErrorInfo::GetSource` function. |
| [`GUID`](../cpp/com-error-guid.md) | Calls `IErrorInfo::GetGUID` function. |

### Format Message Extractor
### Format message extractor

| Name | Description |
|-|-|
|[ErrorMessage](../cpp/com-error-errormessage.md)|Retrieves the string message for HRESULT stored in the **_com_error** object.|
|---|---|
| [`ErrorMessage`](../cpp/com-error-errormessage.md) | Retrieves the string message for `HRESULT` stored in the `_com_error` object. |

### ExepInfo.wCode to HRESULT Mappers
### `ExepInfo.wCode` to `HRESULT` mappers

| Name | Description |
|-|-|
|[HRESULTToWCode](../cpp/com-error-hresulttowcode.md)|Maps 32-bit HRESULT to 16-bit `wCode`.|
|[WCodeToHRESULT](../cpp/com-error-wcodetohresult.md)|Maps 16-bit `wCode` to 32-bit HRESULT.|
|---|---|
| [`HRESULTToWCode`](../cpp/com-error-hresulttowcode.md) | Maps 32-bit `HRESULT` to 16-bit `wCode`. |
| [`WCodeToHRESULT`](../cpp/com-error-wcodetohresult.md) | Maps 16-bit `wCode` to 32-bit `HRESULT`. |

**END Microsoft Specific**

## Requirements

**Header:** \<comdef.h>

`Lib:` comsuppw.lib or comsuppwd.lib (see [/Zc:wchar_t (wchar_t Is Native Type)](../build/reference/zc-wchar-t-wchar-t-is-native-type.md) for more information)
**Library:** *`comsuppw.lib`* or *`comsuppwd.lib`* (for more information, see [`/Zc:wchar_t` (wchar_t is native type)](../build/reference/zc-wchar-t-wchar-t-is-native-type.md))

## See also

[Compiler COM Support Classes](../cpp/compiler-com-support-classes.md)<br/>
[IErrorInfo Interface](/windows/win32/api/oaidl/nn-oaidl-ierrorinfo)
[Compiler COM support classes](../cpp/compiler-com-support-classes.md)\
[`IErrorInfo` interface](/windows/win32/api/oaidl/nn-oaidl-ierrorinfo)
Loading