Skip to content

Commit 0528953

Browse files
authored
Merge pull request #6086 from MicrosoftDocs/FromPublicMasterBranch
Confirm merge from FromPublicMasterBranch to main to sync with https://github.com/MicrosoftDocs/cpp-docs (branch main)
2 parents 4171a71 + 4a49718 commit 0528953

File tree

1,082 files changed

+7205
-4875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,082 files changed

+7205
-4875
lines changed

docs/build/cmake-presets-vs.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,29 +205,33 @@ The official [CMake documentation](https://cmake.org/cmake/help/latest/manual/cm
205205

206206
### Select your compilers
207207

208-
You can set C and C++ compilers by using `cacheVariables.CMAKE_C_COMPILER` and `cacheVariables.CMAKE_CXX_COMPILER` in a Configure Preset. It's equivalent to passing `-D CMAKE_C_COMPILER=<value>` and `-D CMAKE_CXX_COMPILER=<value>` to CMake from the command line. For more information, see [`CMAKE_<LANG>_COMPILER`](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html#cmake-lang-compiler).
208+
You can set C and C++ compilers by using `environment.CC` and `environment.CXX` in a Configure Preset. For more information, see [`CC`](https://cmake.org/cmake/help/latest/envvar/CC.html)/[`CXX`](https://cmake.org/cmake/help/latest/envvar/CXX.html).
209209

210210
Use the following examples to build with `cl.exe` and `clang-cl.exe` from Visual Studio. The C++ Clang tools for Windows components must be installed for you to build with `clang-cl`.
211211

212212
Build with `cl.exe`:
213213

214214
```json
215+
"environment": {
216+
"CC": "cl",
217+
"CXX": "cl"
218+
},
215219
"cacheVariables": {
216220
"CMAKE_BUILD_TYPE": "Debug",
217-
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
218-
"CMAKE_C_COMPILER": "cl",
219-
"CMAKE_CXX_COMPILER": "cl"
221+
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
220222
},
221223
```
222224

223225
Build with `clang`:
224226

225227
```json
228+
"environment": {
229+
"CC": "clang-cl",
230+
"CXX": "clang-cl"
231+
},
226232
"cacheVariables": {
227233
"CMAKE_BUILD_TYPE": "Debug",
228234
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
229-
"CMAKE_C_COMPILER": "clang-cl",
230-
"CMAKE_CXX_COMPILER": "clang-cl"
231235
},
232236

233237
"vendor": {
@@ -264,11 +268,13 @@ To reproduce these builds outside Visual Studio, see [Run CMake from the command
264268
To build on Linux or without the Visual C++ toolset, specify the name of a compiler on your `PATH` instance, or an environment variable that evaluates to the full path of a compiler. Full paths are discouraged so that the file can remain shareable. A preset that builds with GCC version 8 might look like this:
265269

266270
```json
271+
"environment": {
272+
"CC": "gcc-8",
273+
"CXX": "g++-8"
274+
},
267275
"cacheVariables": {
268276
"CMAKE_BUILD_TYPE": "Debug",
269-
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
270-
"CMAKE_C_COMPILER": "gcc-8",
271-
"CMAKE_CXX_COMPILER": "g++-8"
277+
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
272278
},
273279
```
274280

docs/error-messages/compiler-errors-1/compiler-error-c2081.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
---
2-
description: "Learn more about: Compiler Error C2081"
32
title: "Compiler Error C2081"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2081"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2081"]
66
helpviewer_keywords: ["C2081"]
7-
ms.assetid: 7db9892d-364d-4178-a49d-f8398ece09a0
87
---
98
# Compiler Error C2081
109

11-
'identifier' : name in formal parameter list illegal
10+
> 'identifier' : name in formal parameter list illegal
11+
12+
## Remarks
1213

1314
The identifier caused a syntax error.
1415

1516
This error can be caused by using the old style for the formal parameter list. You must specify the type of formal parameters in the formal parameter list.
1617

17-
The following sample generates C2081:
18+
## Example
19+
20+
The following example generates C2081:
1821

1922
```c
2023
// C2081.c

docs/error-messages/compiler-errors-1/compiler-error-c2082.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Error C2082"
32
title: "Compiler Error C2082"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2082"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2082"]
66
helpviewer_keywords: ["C2082"]
7-
ms.assetid: 87a6d442-157c-46e8-9bff-8388f8338ae0
87
---
98
# Compiler Error C2082
109

11-
redefinition of formal parameter 'identifier'
10+
> redefinition of formal parameter 'identifier'
11+
12+
## Remarks
1213

1314
A formal parameter to a function is redeclared within the function body. To resolve the error, remove the redefinition.
1415

15-
The following sample generates C2082:
16+
## Example
17+
18+
The following example generates C2082:
1619

1720
```cpp
1821
// C2082.cpp
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
2-
description: "Learn more about: Compiler Error C2083"
32
title: "Compiler Error C2083"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2083"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2083"]
66
helpviewer_keywords: ["C2083"]
7-
ms.assetid: 5fc4f931-eab6-4d8d-a3ee-3b8e11e64b18
87
---
98
# Compiler Error C2083
109

11-
struct/union comparison illegal
10+
> struct/union comparison illegal
11+
12+
## Remarks
1213

1314
A structure or union is compared directly with another user-defined type. This is not allowed unless a comparison operator has been defined or a conversion to a scalar type exists.

docs/error-messages/compiler-errors-1/compiler-error-c2084.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Error C2084"
32
title: "Compiler Error C2084"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2084"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2084"]
66
helpviewer_keywords: ["C2084"]
7-
ms.assetid: 990b107f-3721-4851-ae8b-4b69a8c149ed
87
---
98
# Compiler Error C2084
109

11-
function '*function*' already has a body
10+
> function '*function*' already has a body
11+
12+
## Remarks
1213

1314
The function has already been defined.
1415

@@ -20,7 +21,7 @@ Before Visual Studio 2002,
2021

2122
## Example
2223

23-
The following sample generates C2084:
24+
The following example generates C2084:
2425

2526
```cpp
2627
// C2084.cpp

docs/error-messages/compiler-errors-1/compiler-error-c2085.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Error C2085"
32
title: "Compiler Error C2085"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2085"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2085"]
66
helpviewer_keywords: ["C2085"]
7-
ms.assetid: 0a86785c-8e6f-481b-8c7b-412220c1950d
87
---
98
# Compiler Error C2085
109

11-
'identifier' : not in formal parameter list
10+
> 'identifier' : not in formal parameter list
11+
12+
## Remarks
1213

1314
The identifier was declared in a function definition but not in the formal parameter list. (ANSI C only)
1415

15-
The following sample generates C2085:
16+
## Example
17+
18+
The following example generates C2085:
1619

1720
```c
1821
// C2085.c

docs/error-messages/compiler-errors-1/compiler-error-c2086.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ helpviewer_keywords: ["C2086"]
77
---
88
# Compiler Error C2086
99

10-
'identifier' : redefinition
10+
> 'identifier' : redefinition
11+
12+
## Remarks
1113

1214
The identifier is defined more than once, or a subsequent declaration differs from a previous one.
1315

1416
C2086 can also be the result of incremental building for a referenced C# assembly. Rebuild the C# assembly to resolve this error.
1517

16-
The following sample generates C2086:
18+
## Example
19+
20+
The following example generates C2086:
1721

1822
```cpp
1923
// C2086.cpp

docs/error-messages/compiler-errors-1/compiler-error-c2087.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Error C2087"
32
title: "Compiler Error C2087"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2087"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2087"]
66
helpviewer_keywords: ["C2087"]
7-
ms.assetid: 89761e83-415a-4468-a4c6-b6dedfd1dd6a
87
---
98
# Compiler Error C2087
109

11-
'identifier' : missing subscript
10+
> 'identifier' : missing subscript
11+
12+
## Remarks
1213

1314
The definition of an array with multiple subscripts is missing a subscript value for a dimension higher than one.
1415

15-
The following sample generates C2087:
16+
## Example
17+
18+
The following example generates C2087:
1619

1720
```cpp
1821
// C2087.cpp

docs/error-messages/compiler-errors-1/compiler-error-c2088.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Error C2088"
32
title: "Compiler Error C2088"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2088"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2088"]
66
helpviewer_keywords: ["C2088"]
7-
ms.assetid: b93f7094-185b-423d-8bb9-507cd757dbf5
87
---
98
# Compiler Error C2088
109

11-
'operator' : illegal for 'class-key'
10+
> 'operator' : illegal for 'class-key'
11+
12+
## Remarks
1213

1314
The operator was not defined for the structure or union. This error is only valid for C code.
1415

15-
The following sample generates C2088 three times:
16+
## Example
17+
18+
The following example generates C2088 three times:
1619

1720
```c
1821
// C2088.c
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
2-
description: "Learn more about: Compiler Error C2089"
32
title: "Compiler Error C2089"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2089"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2089"]
66
helpviewer_keywords: ["C2089"]
7-
ms.assetid: 7c777775-5535-4eea-b6a2-340b71af9560
87
---
98
# Compiler Error C2089
109

11-
'identifier' : 'class-key' too large
10+
> 'identifier' : 'class-key' too large
11+
12+
## Remarks
1213

1314
The specified structure or union exceeds the 4GB limit.

0 commit comments

Comments
 (0)