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
Copy file name to clipboardExpand all lines: docs/build/cmake-presets-vs.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Configure and build with CMake Presets
3
3
description: "Reference for using CMake Presets to configure and build CMake projects."
4
-
ms.date: 02/01/2023
4
+
ms.date: 06/09/2023
5
5
ms.topic: reference
6
6
---
7
7
@@ -386,9 +386,9 @@ Instead, set the path to `vcpkg.cmake` by using the `VCPKG_ROOT` environment var
386
386
},
387
387
```
388
388
389
-
`VCPKG_ROOT` should be set to the root of your vcpkg installation. For more information, see [vcpkg environment variables](https://github.com/microsoft/vcpkg/blob/master/docs/users/config-environment.md).
389
+
`VCPKG_ROOT` should be set to the root of your vcpkg installation. For more information, see [vcpkg environment variables](/vcpkg/users/config-environment).
390
390
391
-
If you're already using a CMake toolchain file and want to enable vcpkg integration, see [Using multiple toolchain files](https://github.com/microsoft/vcpkg/blob/master/docs/users/buildsystems/integration.md#using-multiple-toolchain-files). Follow those instructions to use an external toolchain file with a project by using vcpkg.
391
+
If you're already using a CMake toolchain file and want to enable vcpkg integration, see [Using multiple toolchain files](/vcpkg/users/buildsystems/cmake-integration#using-multiple-toolchain-files). Follow those instructions to use an external toolchain file with a project by using vcpkg.
392
392
393
393
## Variable substitution in *`launch.vs.json`* and *`tasks.vs.json`*
@@ -51,7 +50,7 @@ Specifies the type of debugging information generated by the compiler. This pro
51
50
-**None** - Produces no debugging information, so compilation may be faster.
52
51
-**C7 compatible** - Select the type of debugging information created for your program and whether this information is kept in object (.obj) files or in a program database (PDB).
53
52
-**Program Database** - Produces a program database (PDB) that contains type information and symbolic debugging information for use with the debugger. The symbolic debugging information includes the names and types of variables and functions, and line numbers.
54
-
-**Program Database for Edit And Continue** - Produces a program database, as described above, in a format that supports the [Edit and Continue](/visualstudio/debugger/edit-and-continue) feature.
53
+
-**Program Database for Edit And Continue** - Produces a program database, as described previously, in a format that supports the [Edit and Continue](/visualstudio/debugger/edit-and-continue) feature.
55
54
56
55
### Support Just My Code Debugging
57
56
@@ -142,7 +141,7 @@ Select the level of [inline function](../../cpp/inline-functions-cpp.md) expansi
142
141
-**Default**
143
142
-**Disabled** - Disables inline expansion, which is on by default.
144
143
-**Only __inline** - Expands only functions marked as **`inline`**, **`__forceinline`**, or **`__inline`**. Or, in a C++ member function, defined within a class declaration.
145
-
-**Any Suitable** - Expands functions marked as **`inline`** or **`__inline`** and any other function that the compiler chooses. (Expansion occurs at the compiler's discretion, often referred to as *auto-inlining*.)
144
+
-**Any Suitable** - Expands functions marked as **`inline`** or **`__inline`** and any other function that the compiler chooses. (Expansion occurs at the compiler's discretion, often referred to as *autoinlining*.)
-**Multi-threaded** - Causes your application to use the multithread, static version of the run-time library.
246
-
-**Multi-threaded Debug** - Defines _DEBUG and _MT. This option also causes the compiler to place the library name *LIBCMTD.lib* into the *`.obj`* file so that the linker will use *LIBCMTD.lib* to resolve external symbols.
245
+
-**Multi-threaded Debug** - Defines `_DEBUG` and `_MT`. This option also causes the compiler to place the library name *`LIBCMTD.lib`* into the *`.obj`* file so that the linker will use *`LIBCMTD.lib`* to resolve external symbols.
247
246
-**Multi-threaded DLL** - Causes your application to use the multithread- and DLL-specific version of the run-time library. Defines `_MT` and `_DLL` and causes the compiler to place the library name *MSVCRT.lib* into the *`.obj`* file.
248
-
-**Multi-threaded Debug DLL** - Defines `_DEBUG`, `_MT`, and `_DLL` and causes your application to use the debug multithread- and DLL-specific version of the run-time library. It also causes the compiler to place the library name *MSVCRTD.lib* into the *`.obj`* file.
247
+
-**Multi-threaded Debug DLL** - Defines `_DEBUG`, `_MT`, and `_DLL` and causes your application to use the debug multithread- and DLL-specific version of the run-time library. It also causes the compiler to place the library name *`MSVCRTD.lib`* into the *`.obj`* file.
249
248
250
249
### Struct Member Alignment
251
250
252
251
Specifies 1, 2, 4, or 8-byte boundaries for struct member alignment. Sets [`/Zp`](zp-struct-member-alignment.md).
253
252
254
253
#### Choices
255
254
256
-
-**1 Byte** - Packs structures on 1-byte boundaries. Same as **`/Zp`**.
257
-
-**2 Bytes** - Packs structures on 2-byte boundaries.
258
-
-**4 Bytes** - Packs structures on 4-byte boundaries.
259
-
-**8 Bytes** - Packs structures on 8-byte boundaries (default).
260
-
-**16 Bytes** - Packs structures on 16-byte boundaries.
255
+
-**1 Byte** - Packs structures on one-byte boundaries. Same as **`/Zp`**.
256
+
-**2 Bytes** - Packs structures on two-byte boundaries.
257
+
-**4 Bytes** - Packs structures on four-byte boundaries.
258
+
-**8 Bytes** - Packs structures on eight-byte boundaries (default).
259
+
-**16 Bytes** - Packs structures on sixteen-byte boundaries.
261
260
-**Default** - Default alignment settings.
262
261
263
262
### Security Check
@@ -288,7 +287,7 @@ Allows the compiler to generate parallel code for loops identified using `#pragm
288
287
289
288
### Enable Enhanced Instruction Set
290
289
291
-
Enable use of instructions found on processors that support enhanced instruction sets. For example, the SSE, SSE2, AVX, and AVX2 enhancements to IA-32. And, the AVX and AVX2 enhancements to x64. Currently **`/arch:SSE`** and **`/arch:SSE2`** are only available when building for the x86 architecture. If no option is specified, the compiler will use instructions found on processors that support SSE2. Use of enhanced instructions can be disabled with **`/arch:IA32`**. For more information, see [`/arch (x86)`](arch-x86.md), [`/arch (x64)`](arch-x64.md), [`/arch (ARM64)`](arch-arm64.md), and [`/arch (ARM)`](arch-arm.md).
290
+
Enable use of instructions found on processors that support enhanced instruction sets. For example, the SSE, SSE2, AVX, and AVX2 enhancements to IA-32. And, the AVX and AVX2 enhancements to x64. Currently **`/arch:SSE`** and **`/arch:SSE2`** are only available when building for the x86 architecture. If no option is specified, the compiler uses instructions found on processors that support SSE2. Use of enhanced instructions can be disabled with **`/arch:IA32`**. For more information, see [`/arch (x86)`](arch-x86.md), [`/arch (x64)`](arch-x64.md), [`/arch (ARM64)`](arch-arm64.md), and [`/arch (ARM)`](arch-arm.md).
Suppresses or enables language extensions. Sets [`/Za`](za-ze-disable-language-extensions.md).
334
333
335
-
### Conformance mode
336
-
337
-
Enables or suppresses conformance mode. Sets [`/permissive-`](permissive-standards-conformance.md).
338
-
339
-
### Treat wchar_t As Built in Type
334
+
### Treat WChar_t As Built in Type
340
335
341
336
When specified, the type **`wchar_t`** becomes a native type that maps to **`__wchar_t`** in the same way that **`short`** maps to **`__int16`**. [`/Zc:wchar_t`](zc-wchar-t-wchar-t-is-native-type.md) is on by default.
342
337
@@ -360,9 +355,9 @@ Adds code for checking C++ object types at run time (*runtime type information*,
360
355
361
356
Enables OpenMP 2.0 language extensions. Sets [`/openmp`](openmp-enable-openmp-2-0-support.md).
362
357
363
-
### C++ Language Standard
358
+
### <aname="cpplang"></a> C++ Language Standard
364
359
365
-
Determines the C++ language standard the compiler enables. The default value doesn't set a standard option, so the compiler uses its default C++14 setting. If you select a specific value, the corresponding [`/std`](std-specify-language-standard-version.md) compiler option is set.md).
360
+
Determines the C++ language standard that the compiler enables. The default value doesn't set a standard option, so the compiler uses its default C++14 setting. If you select a specific value, the corresponding [`/std`](std-specify-language-standard-version.md) compiler option is set.md).
366
361
367
362
#### Choices
368
363
@@ -372,10 +367,28 @@ Determines the C++ language standard the compiler enables. The default value doe
372
367
-**ISO C++20 Standard (/std:c++20)**
373
368
-**Preview - Features from the Latest C++ Working Draft (/std:c++latest)**
374
369
375
-
### Enable C++ Modules (experimental)
370
+
### C Language Standard
371
+
372
+
Determines the C language standard that the compiler enables. The default value doesn't set a standard option, so the compiler uses its default legacy MSVC setting. If you select a specific value, the corresponding [`/std`](std-specify-language-standard-version.md) compiler option is set.md).
373
+
374
+
#### Choices
375
+
376
+
-**Default (Legacy MSVC)**
377
+
-**ISO C11 Standard (/std:c11)**
378
+
-**ISO C17 (2018) Standard (/std:c17)**
379
+
380
+
### Conformance mode
381
+
382
+
Enables or suppresses conformance mode. Sets [`/permissive-`](permissive-standards-conformance.md).
383
+
384
+
### Enable Experimental C++ Standard Library Modules
376
385
377
386
Experimental support for the C++ Modules TS and Standard Library modules.
378
387
388
+
### Build ISO C++23 Standard Library Modules
389
+
390
+
Starting in Visual Studio 17.6, when this property is enabled and [C++ Language Standard](#cpplang) is set to `/std:c++latest`, Visual C++ projects automatically find and build ISO C++23 Standard Library modules. This enables you to `import std` or `import std.compat` in your C++ code.
> The requirement is not satisfied. (The expression does not evaluate to true.)
12
12
13
-
This warning indicates that the function prototype for the function being analyzed has a `__notnull`, `__null` or `__drv_valueIs` on an `_Out_` parameter or the return value, but the value returned is inconsistent with that annotation.
13
+
This warning indicates that the function being analyzed has a `__notnull`, `__null`, `__drv_valueIs` or similar annotation on an `_Out_` parameter or the return value, but the value returned is inconsistent with that annotation.
14
+
15
+
## Remarks
16
+
17
+
Annotations like `__notnull` describe invariants about `_Out_` parameters and return values, which serves both as documentation and as a sanity check for the author of the function. Warning C28196 indicates a mismatch between the annotations and the actual behavior of the function. The warning can be useful for discovering cases where a function might behave unexpectedly for certain input values. It's then up to the author to decide what the intended behavior of the function is and either adapt the annotations or the implementation accordingly.
18
+
19
+
## Examples
20
+
21
+
The following function causes warning C28196 because it's annotated with `_Ret_notnull_` even though some code paths return a null pointer.
description: Modules in C++20 provide a modern alternative to header files.
6
6
---
7
7
# Overview of modules in C++
8
8
9
-
C++20 introduces *modules*, a modern solution that turns C++ libraries and programs into components. A *module* is a set of source code files that are compiled independently of the [translation units](https://wikipedia.org/wiki/Translation_unit_(programming)) that import them. Modules eliminate or reduce many of the problems associated with the use of header files. They often reduce compilation times. Macros, preprocessor directives, and non-exported names declared in a module aren't visible outside the module. They have no effect on the compilation of the translation unit that imports the module. You can import modules in any order without concern for macro redefinitions. Declarations in the importing translation unit don't participate in overload resolution or name lookup in the imported module. After a module is compiled once, the results are stored in a binary file that describes all the exported types, functions, and templates. The compiler can process that file much faster than a header file. And, the compiler can reuse it every place where the module is imported in a project.
9
+
C++20 introduces *modules*, a modern solution that turns C++ libraries and programs into components. A *module* is a set of source code files that are compiled independently of the source files (or more precisely, the [translation units](https://wikipedia.org/wiki/Translation_unit_(programming)) that import them. Modules eliminate or reduce many of the problems associated with the use of header files. They often reduce compilation times. Macros, preprocessor directives, and non-exported names declared in a module aren't visible outside the module. They have no effect on the compilation of the translation unit that imports the module. You can import modules in any order without concern for macro redefinitions. Declarations in the importing translation unit don't participate in overload resolution or name lookup in the imported module. After a module is compiled once, the results are stored in a binary file that describes all the exported types, functions, and templates. The compiler can process that file much faster than a header file. And, the compiler can reuse it every place where the module is imported in a project.
10
10
11
-
You can use modules side by side with header files. A C++ source file can `import` modules and also `#include` header files. In some cases, you can import a header file as a module rather than include it textually by using `#include`in the preprocessor. We recommend you use modules in new projects rather than header files as much as possible. For larger existing projects under active development, experiment with converting legacy headers to modules. Base your adoption on whether you get a meaningful reduction in compilation times.
11
+
You can use modules side by side with header files. A C++ source file can `import` modules and also `#include` header files. In some cases, you can import a header file as a module, which is faster than using `#include`to process it with the preprocessor. We recommend that you use modules in new projects rather than header files as much as possible. For larger existing projects under active development, experiment with converting legacy headers to modules. Base your adoption on whether you get a meaningful reduction in compilation times.
12
12
13
13
To contrast modules with other ways to import the standard library, see [Compare header units, modules, and precompiled headers](../build/compare-inclusion-methods.md).
14
14
15
15
## Enable modules in the Microsoft C++ compiler
16
16
17
17
As of Visual Studio 2022 version 17.1, C++20 standard modules are fully implemented in the Microsoft C++ compiler.
18
18
19
-
Before it was specified by the C++20 standard, Microsoft had experimental support for modules in the Microsoft C++ compiler. The compiler also supported importing the Standard Library as modules, described below.
19
+
Before it was specified by the C++20 standard, Microsoft had experimental support for modules. The compiler also supported importing pre-built Standard Library modules, described below.
20
20
21
21
Starting with Visual Studio 2022 version 17.5, importing the Standard Library as a module is both standardized and fully implemented in the Microsoft C++ compiler. This section describes the older, experimental method, which is still supported. For information about the new standardized way to import the Standard Library using modules, see [Import the C++ standard library using modules](tutorial-import-stl-named-module.md).
0 commit comments