Skip to content

Commit 5ea6002

Browse files
TylerMSFTTylerMSFT
authored andcommitted
Alt-text related work
1 parent a2d655c commit 5ea6002

9 files changed

Lines changed: 66 additions & 71 deletions

docs/atl/reference/compiler-options-macros.md

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
---
22
description: "Learn more about: Compiler Options Macros"
33
title: "Compiler Options Macros"
4-
ms.date: "08/19/2019"
4+
ms.date: 02/01/2023
55
f1_keywords: ["_ATL_ALL_WARNINGS", "_ATL_APARTMENT_THREADED", "_ATL_CSTRING_EXPLICIT_CONSTRUCTORS ", "_ATL_ENABLE_PTM_WARNING", "_ATL_FREE_THREADED", "_ATL_MODULES", "_ATL_MULTI_THREADED", "_ATL_NO_AUTOMATIC_NAMESPACE", "_ATL_NO_COM_SUPPORT", "ATL_NO_VTABLE", "ATL_NOINLINE", "_ATL_SINGLE_THREADED"]
66
helpviewer_keywords: ["compiler options, macros"]
7-
ms.assetid: a869adc6-b3de-4299-b040-9ae20b45f82c
87
---
98
# Compiler Options Macros
109

1110
These macros control specific compiler features.
1211

1312
|Macro|Description|
1413
|-|-|
15-
|[_ATL_ALL_WARNINGS](#_atl_all_warnings)|A symbol that enables errors in projects converted from previous versions of ATL.|
16-
|[_ATL_APARTMENT_THREADED](#_atl_apartment_threaded)|Define if one or more of your objects use apartment threading.|
17-
|[_ATL_CSTRING_EXPLICIT_CONSTRUCTORS](#_atl_cstring_explicit_constructors)|Makes certain `CString` constructors explicit, preventing any unintentional conversions.|
18-
|[_ATL_ENABLE_PTM_WARNING](#_atl_enable_ptm_warning)|Define this macro to require C++ standard syntax. It generates the C4867 compiler error when non-standard syntax is used to initialize a pointer to a member function.|
19-
|[_ATL_FREE_THREADED](#_atl_free_threaded)|Define if one or more of your objects use free or neutral threading.|
20-
|[_ATL_MODULES](#_ATL_MODULES)|Allows you to compile ATL projects with [permissive-](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).|
21-
|[_ATL_MULTI_THREADED](#_atl_multi_threaded)|A symbol that indicates the project will have objects that are marked as Both, Free or Neutral. The macro [_ATL_FREE_THREADED](#_atl_free_threaded) should be used instead.|
22-
|[_ATL_NO_AUTOMATIC_NAMESPACE](#_atl_no_automatic_namespace)|A symbol that prevents the default use of namespace as ATL.|
23-
|[_ATL_NO_COM_SUPPORT](#_atl_no_com_support)|A symbol that prevents COM-related code from being compiled with your project.|
24-
|[ATL_NO_VTABLE](#atl_no_vtable)|A symbol that prevents the vtable pointer from being initialized in the class's constructor and destructor.|
25-
|[ATL_NOINLINE](#atl_noinline)|A symbol that indicates a function shouldn't be inlined.|
26-
|[_ATL_SINGLE_THREADED](#_atl_single_threaded)|Define if all of your objects use the single threading model.|
27-
28-
## <a name="_atl_all_warnings"></a> _ATL_ALL_WARNINGS
14+
|[`_ATL_ALL_WARNINGS`](#_atl_all_warnings)|A symbol that enables errors in projects converted from previous versions of ATL.|
15+
|[`_ATL_APARTMENT_THREADED`](#_atl_apartment_threaded)|Define if one or more of your objects use apartment threading.|
16+
|[`_ATL_CSTRING_EXPLICIT_CONSTRUCTORS`](#_atl_cstring_explicit_constructors)|Makes certain `CString` constructors explicit, preventing any unintentional conversions.|
17+
|[`_ATL_ENABLE_PTM_WARNING`](#_atl_enable_ptm_warning)|Define this macro to require C++ standard syntax. It generates the C4867 compiler error when non-standard syntax is used to initialize a pointer to a member function.|
18+
|[`_ATL_FREE_THREADED`](#_atl_free_threaded)|Define if one or more of your objects use free or neutral threading.|
19+
|[`_ATL_MODULES`](#_ATL_MODULES)|Allows you to compile ATL projects with [permissive-](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).|
20+
|[`_ATL_MULTI_THREADED`](#_atl_multi_threaded)|A symbol that indicates the project will have objects that are marked as Both, Free or Neutral. The macro [`_ATL_FREE_THREADED`](#_atl_free_threaded) should be used instead.|
21+
|[`_ATL_NO_AUTOMATIC_NAMESPACE`](#_atl_no_automatic_namespace)|A symbol that prevents the default use of namespace as ATL.|
22+
|[`_ATL_NO_COM_SUPPORT`](#_atl_no_com_support)|A symbol that prevents COM-related code from being compiled with your project.|
23+
|[`ATL_NO_VTABLE`](#atl_no_vtable)|A symbol that prevents the vtable pointer from being initialized in the class's constructor and destructor.|
24+
|[`ATL_NOINLINE`](#atl_noinline)|A symbol that indicates a function shouldn't be inlined.|
25+
|[`_ATL_SINGLE_THREADED`](#_atl_single_threaded)|Define if all of your objects use the single threading model.|
26+
27+
## <a name="_atl_all_warnings"></a> `_ATL_ALL_WARNINGS`
2928

3029
A symbol that enables errors in projects converted from previous versions of ATL.
3130

@@ -61,7 +60,7 @@ If this `#define` is added, the ATL headers are careful to preserve the state of
6160

6261
New projects have this `#define` set in *pch.h* (*stdafx.h* in Visual Studio 2017 and earlier) by default.
6362

64-
## <a name="_atl_apartment_threaded"></a> _ATL_APARTMENT_THREADED
63+
## <a name="_atl_apartment_threaded"></a> `_ATL_APARTMENT_THREADED`
6564

6665
Define if one or more of your objects use apartment threading.
6766

@@ -73,7 +72,7 @@ _ATL_APARTMENT_THREADED
7372

7473
Specifies apartment threading. For other options, and a description of the threading models available for an ATL object, see [Specifying the Project's Threading Model](../../atl/specifying-the-threading-model-for-a-project-atl.md) and [Options, ATL Simple Object Wizard](../../atl/reference/options-atl-simple-object-wizard.md).
7574

76-
## <a name="_atl_cstring_explicit_constructors"></a> _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
75+
## <a name="_atl_cstring_explicit_constructors"></a> `_ATL_CSTRING_EXPLICIT_CONSTRUCTORS`
7776

7877
Makes certain `CString` constructors explicit, preventing any unintentional conversions.
7978

@@ -85,9 +84,9 @@ _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
8584

8685
When this constructor is defined, all CString constructors that take a single parameter are compiled with the explicit keyword, which prevents implicit conversions of input arguments. This means, for example, that when _UNICODE is defined, if you attempt to use a char* string as a CString constructor argument, a compiler error will result. Use this macro in situations where you need to prevent implicit conversions between narrow and wide string types.
8786

88-
By using the _T macro on all constructor string arguments, you can define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS and avoid compile errors regardless of whether _UNICODE is defined.
87+
By using the `_T` macro on all constructor string arguments, you can define `_ATL_CSTRING_EXPLICIT_CONSTRUCTORS` and avoid compile errors regardless of whether `_UNICODE` is defined.
8988

90-
## <a name="_atl_enable_ptm_warning"></a> _ATL_ENABLE_PTM_WARNING
89+
## <a name="_atl_enable_ptm_warning"></a> `_ATL_ENABLE_PTM_WARNING`
9190

9291
Define this macro in order to force the use of ANSI C++ standard-conforming syntax for pointer to member functions. Using this macro will cause the C4867 compiler error to be generated when non-standard syntax is used to initialize a pointer to a member function.
9392

@@ -99,7 +98,7 @@ Define this macro in order to force the use of ANSI C++ standard-conforming synt
9998

10099
The ATL and MFC libraries have been changed to match the Microsoft C++ compiler's improved standard C++ conformance. According to the ANSI C++ standard, the syntax of a pointer to a class member function should be `&CMyClass::MyFunc`.
101100

102-
When [_ATL_ENABLE_PTM_WARNING](#_atl_enable_ptm_warning) is not defined (the default case), ATL/MFC disables the C4867 error in macro maps (notably message maps) so that code that was created in earlier versions can continue to build as before. If you define **_ATL_ENABLE_PTM_WARNING**, your code should conform to the C++ standard.
101+
When [`_ATL_ENABLE_PTM_WARNING`](#_atl_enable_ptm_warning) isn't defined (the default case), ATL/MFC disables the C4867 error in macro maps (notably message maps) so that code that was created in earlier versions can continue to build as before. If you define `_ATL_ENABLE_PTM_WARNING`, your code should conform to the C++ standard.
103102

104103
However, the non-standard form has been deprecated. You need to move existing code to C++ standard syntax. For example, the following code:
105104

@@ -111,7 +110,7 @@ Should be changed to:
111110

112111
For map macros, add the ampersand '&' character. You shouldn't add the character again in your code.
113112

114-
## <a name="_atl_free_threaded"></a> _ATL_FREE_THREADED
113+
## <a name="_atl_free_threaded"></a> `_ATL_FREE_THREADED`
115114

116115
Define if one or more of your objects use free or neutral threading.
117116

@@ -125,13 +124,13 @@ Specifies free threading. Free threading is equivalent to a multithread apartmen
125124

126125
## <a name="_ATL_MODULES"></a> `_ATLMODULES`
127126

128-
Allows you to compile ATL projects with [permissive-](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).
127+
Allows you to compile ATL projects with [`permissive-`](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).
129128

130129
```
131130
_ATL_MODULES
132131
```
133132

134-
## <a name="_atl_multi_threaded"></a> _ATL_MULTI_THREADED
133+
## <a name="_atl_multi_threaded"></a> `_ATL_MULTI_THREADED`
135134

136135
A symbol that indicates the project will have objects that are marked as Both, Free or Neutral.
137136

@@ -141,9 +140,9 @@ _ATL_MULTI_THREADED
141140

142141
### Remarks
143142

144-
If this symbol is defined, ATL will pull in code that will correctly synchronize access to global data. New code should use the equivalent macro [_ATL_FREE_THREADED](#_atl_free_threaded) instead.
143+
If this symbol is defined, ATL will pull in code that will correctly synchronize access to global data. New code should use the equivalent macro [`_ATL_FREE_THREADED`](#_atl_free_threaded) instead.
145144

146-
## <a name="_atl_no_automatic_namespace"></a> _ATL_NO_AUTOMATIC_NAMESPACE
145+
## <a name="_atl_no_automatic_namespace"></a> `_ATL_NO_AUTOMATIC_NAMESPACE`
147146

148147
A symbol that prevents the default use of namespace as ATL.
149148

@@ -153,17 +152,17 @@ _ATL_NO_AUTOMATIC_NAMESPACE
153152

154153
### Remarks
155154

156-
If this symbol is not defined, including atlbase.h will perform **using namespace ATL** by default, which may lead to naming conflicts. To prevent this, define this symbol.
155+
If this symbol isn't defined, including `atlbase.h` will perform `using namespace ATL` by default, which may lead to naming conflicts. To prevent this, define this symbol.
157156

158-
## <a name="_atl_no_com_support"></a> _ATL_NO_COM_SUPPORT
157+
## <a name="_atl_no_com_support"></a> `_ATL_NO_COM_SUPPORT`
159158

160159
A symbol that prevents COM-related code from being compiled with your project.
161160

162161
```
163162
_ATL_NO_COM_SUPPORT
164163
```
165164

166-
## <a name="atl_no_vtable"></a> ATL_NO_VTABLE
165+
## <a name="atl_no_vtable"></a> `ATL_NO_VTABLE`
167166

168167
A symbol that prevents the vtable pointer from being initialized in the class's constructor and destructor.
169168

@@ -173,13 +172,13 @@ ATL_NO_VTABLE
173172

174173
### Remarks
175174

176-
If the vtable pointer is prevented from being initialized in the class's constructor and destructor, the linker can eliminate the vtable and all of the functions to which it points. Expands to **`__declspec(novtable)`**.
175+
If the vtable pointer is prevented from being initialized in the class's constructor and destructor, the linker can eliminate the vtable and all of the functions to which it points. Expands to `__declspec(novtable)`.
177176

178177
### Example
179178

180179
[!code-cpp[NVC_ATL_COM#53](../../atl/codesnippet/cpp/compiler-options-macros_4.h)]
181180

182-
## <a name="atl_noinline"></a> ATL_NOINLINE
181+
## <a name="atl_noinline"></a> `ATL_NOINLINE`
183182

184183
A symbol that indicates a function shouldn't be inlined.
185184

@@ -193,14 +192,14 @@ A symbol that indicates a function shouldn't be inlined.
193192

194193
### Parameters
195194

196-
*myfunction*<br/>
195+
*`myfunction`*\
197196
The function that should not be inlined.
198197

199198
### Remarks
200199

201-
Use this symbol if you want to ensure a function does not get inlined by the compiler, even though it must be declared as inline so that it can be placed in a header file. Expands to **`__declspec(noinline)`**.
200+
Use this symbol if you want to ensure a function does not get inlined by the compiler, even though it must be declared as inline so that it can be placed in a header file. Expands to `__declspec(noinline)`.
202201

203-
## <a name="_atl_single_threaded"></a> _ATL_SINGLE_THREADED
202+
## <a name="_atl_single_threaded"></a> `_ATL_SINGLE_THREADED`
204203

205204
Define if all of your objects use the single threading model
206205

docs/build/cmake-presets-vs.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Configure and build with CMake Presets
33
description: "Reference for using CMake Presets to configure and build CMake projects."
4-
ms.date: 09/13/2022
4+
ms.date: 02/01/2023
55
ms.topic: reference
66
---
77

@@ -21,22 +21,29 @@ We recommend *`CMakePresets.json`* as an alternative to *`CMakeSettings.json`*.
2121

2222
## Supported CMake and *`CMakePresets.json`* versions
2323

24-
The supported *`CMakePresets.json`* and *`CMakeUserPresets.json`* schema versions depend on your version of Visual Studio. Visual Studio 2019 version 16.10 and later support schema versions 2 and 3. Visual Studio 2022 version 17.4 preview 2 adds support for schema versions 4 and 5. You can update the version by changing the `"version"` field in the root object. For an example and more information, see [`CMakePresets.json` format](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#format).
24+
The supported *`CMakePresets.json`* and *`CMakeUserPresets.json`* schema versions depend on your version of Visual Studio:
25+
- Visual Studio 2019 version 16.10 and later support schema versions 2 and 3.
26+
- Visual Studio 2022 version 17.4 preview 2 adds support for schema versions 4 and 5.
2527

26-
CMake version 3.20 or later is required when you're invoking CMake with *`CMakePresets.json`* from the command line. However, Visual Studio reads and evaluates *`CMakePresets.json`* and *`CMakeUserPresets.json`* itself and doesn't invoke CMake directly with the `--preset` option. So, CMake version 3.20 or later isn't strictly required when you're building with *`CMakePresets.json`* inside Visual Studio. We recommend using at least CMake version 3.14 or later.
28+
You can update the version by changing the `"version"` field in the root object. For an example and more information, see [`CMakePresets.json` format](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#format).
29+
30+
CMake version 3.20 or later is required when you're invoking CMake with *`CMakePresets.json`* from the command line. However, Visual Studio reads and evaluates *`CMakePresets.json`* and *`CMakeUserPresets.json`* itself and doesn't invoke CMake directly with the `--preset` option. So, CMake version 3.20 or later isn't strictly required when you're building with *`CMakePresets.json`* inside Visual Studio.
31+
32+
We recommend using at least CMake version 3.14 or later.
2733

2834
## <a name="enable-cmakepresets-json-integration"></a> Enable *`CMakePresets.json`* integration in Visual Studio
2935

3036
*`CMakePresets.json`* integration isn't enabled by default in Visual Studio. You can enable it in **Tools** > **Options** > **CMake** > **General**:
3137

32-
![Screenshot showing the checkbox to enable CMakePresets.json on the CMake General page of the Tools Options dialog in Visual Studio 2022 version 17.1.](./media/enable-cmakepresets-new.png)
38+
:::image type="content" source="./media/enable-cmakepresets-new.png" alt-text="Screenshot of the older Visual Studio enable CMakePresets.json checkbox. The checkbox reads: Always use CMakePresets.json.":::
3339

3440
> [!IMPORTANT]
3541
> Close and reopen the folder in Visual Studio to activate the integration.
3642
3743
In some older versions of Visual Studio, **Tools** > **Options** > **CMake** > **General** only has a single option to enable *`CMakePresets.json`* integration:
3844

39-
![Screenshot showing the checkbox to enable CMakePresets.json on the CMake General page of the Tools Options dialog in Visual Studio 2019.](./media/enable-cmakepresets.png)
45+
:::image type="content" source="./media/enable-cmakepresets.png" alt-text="Screenshot of older Visual Studio enable CMakePresets.json checkbox which is labeled: Use C Make Presets .json to drive CMake configure, build, and test."
46+
:::image-end:::
4047

4148
The following table indicates when *`CMakePresets.json`* is used instead of *`CMakeSettings.json`* to drive CMake configuration and build in Visual Studio 2022 and Visual Studio 2019 version 16.10 and later. If no configuration file is present, default Configure Presets are used.
4249

@@ -110,15 +117,15 @@ If you try to open or modify a *`CMakePresets.json`* file that doesn't exist, Vi
110117

111118
## Configure and build
112119

113-
Visual Studio provides dropdown lists for the Target Systems, Configure Presets, and Build Presets when *`CMakePresets.json`* integration is enabled:
120+
On the Visual Studio toolbar, there are dropdowns for the Target Systems, Configure Presets, and Build Presets when *`CMakePresets.json`* integration is enabled:
114121

115-
![Screenshot that shows the dropdown lists for the Target System.](./media/target-system-dropdown.png)
122+
:::image type="content" source="./media/target-system-dropdown.png" alt-text="Screenshot showing the dropdowns for target system set to Local Machine, configuration set to windows-arm64, and build preset set to default.":::
116123

117124
### Select a Target System
118125

119126
The dropdown list on the left indicates the active *Target System*. It's the system on which CMake is invoked to configure and build the project. This dropdown list includes your local machine, all SSH connections in Connection Manager by host name, and all Windows Subsystem for Linux (WSL) installations that Visual Studio can find:
120127

121-
![Screenshot of the selections in the dropdown list for the Target System.](./media/target-system-selections.png)
128+
:::image type="content" source="./media/target-system-selections.png" alt-text="Screenshot of the Target System dropdown list which contains: Local Machine, 192.168.0.5, WSL: ubuntu2004, WSL: debian, and Manage Connections.":::
122129

123130
In the preceding example:
124131

@@ -177,7 +184,7 @@ Use a forward slash (`/`) for paths in *`CMakePresets.json`* and *`CMakeUserPres
177184

178185
To add a new Configure Preset to *`CMakePresets.json`*, from **Solution Explorer**, right-click *`CMakePresets.json`* from **Folder View** and select **Add Configuration** from the shortcut menu. The dialog to select a Configure Preset template appears:
179186

180-
![Screenshot of the dialog for adding a Configure Preset to the J S O N file.](./media/add-configure-preset-to-cmakepresets.png)
187+
:::image type="content" source="./media/add-configure-preset-to-cmakepresets.png" alt-text="Screenshot of Visual Studio Add Configure Preset to the JSON file dialog. It contains entries such as Linux Debug, macOS Debug, x64 Debug, and more.":::
181188

182189
Select the **Windows x64 Debug** template to configure on Windows systems. Select the **Linux Debug** template to configure on WSL and remote Linux systems. For more information about editing *`CMakePresets.json`*, see [Edit presets](#edit-presets).
183190

13.8 KB
Loading

0 commit comments

Comments
 (0)