Skip to content

Commit e8dc3b5

Browse files
authored
Merge pull request #5554 from MicrosoftDocs/main
4/19/2024 AM Publish
2 parents fca042a + 62c3edb commit e8dc3b5

23 files changed

+309
-265
lines changed

docs/error-messages/compiler-errors-2/compiler-error-c3859.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,31 @@ title: "Compiler Error C3859"
44
ms.date: 02/22/2022
55
f1_keywords: ["C3859"]
66
helpviewer_keywords: ["C3859"]
7-
ms.assetid: 40e93b25-4393-4467-90de-035434a665c7
87
---
98
# Compiler Error C3859
109

11-
> virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm*value*' or greater
10+
> Failed to create virtual memory for PCH
1211
13-
The virtual memory allocated for your precompiled header is too small for the amount of data the compiler is trying to put in it. Starting in Visual Studio 2015, the **`/Zm`** recommendation is only significant when using the `#pragma hdrstop` directive. In other cases, it's a spurious error that indicates Windows virtual memory pressure issues.
12+
The message has one of the following notes:
13+
>The system returned code *error code*: *OS error message*\
14+
>PCH: Address is not a multiple of the system's allocation granularity\
15+
>PCH: The chunk has not been previously reserved\
16+
>PCH: Commit size too large\
17+
>PCH: Unable to commit memory across file map\
18+
>PCH: Exhausted chunk list before committing all bytes\
19+
>PCH: Unexpected end of chunk list while trying to free\
20+
>PCH: Shouldn't be hitting a file map in the decommit case\
21+
>PCH: Invalid chunk\
22+
>PCH: Map size too large\
23+
>PCH: Unable to map file: memory already committed\
24+
>PCH: File map already in place\
25+
>PCH: Unable to get the requested block of memory\
26+
>Consider using /Fp to allow the compiler to reserve the memory early
1427
15-
If your precompiled header uses a `#pragma hdrstop` directive, use the **`/Zm`** compiler flag to specify a larger value for the precompiled header file. Otherwise, consider reducing the number of parallel compilation processes in your build. For more information, see [`/Zm` (Specify precompiled header memory allocation limit)](../../build/reference/zm-specify-precompiled-header-memory-allocation-limit.md).
28+
There isn't enough virtual memory allocated for your [precompiled header (PCH)](../../build/creating-precompiled-header-files.md). If your precompiled header uses an explicit `#pragma hdrstop` directive, use the **`/Zm`** compiler flag to specify a larger value for the precompiled header file. Otherwise, consider reducing the number of parallel compilation processes in your build. For more information, see [`/Zm` (Specify precompiled header memory allocation limit)](../../build/reference/zm-specify-precompiled-header-memory-allocation-limit.md).
29+
30+
This diagnostic shows up mostly in two scenarios:
31+
32+
The first scenario is that the system is overloaded with multiple `/Yu` compile requests at the same time. Setting the maximum starting virtual memory size typically resolves this issue.
33+
34+
The second scenario is when the the Windows loader injects a DLL into the process at startup. That injected DLL can allocate memory that conflicts with where the PCH must reside. For example, `msbuild.exe` injects `FileTracker.dll` into every `CL.exe` process at startup. In this scenario, using the [`/Fp` (Name .pch file)](../../build/reference/fp-name-dot-pch-file.md) flag ensures that the memory for the PCH is allocated as early as possible in the `CL.exe` process, before any injected DLLs try to occupy the address space. These failures can be intermittent because Windows Address Space Layout Randomization (ASLR) allocates memory at different addresses across different process invocations. Without `/Fp`, memory for the PCH can't be allocated until the compiler finds the header file `#include` specified in the `/Yu` command line option or the `#pragma hdrstop`. By this time, it's much more likely that the memory required by the PCH is already reserved.

docs/error-messages/compiler-errors-2/compiler-errors-c3500-through-c3999.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ description: "Learn more about: Compiler errors C3500 through C3999"
33
title: "Compiler errors C3500 through C3999"
44
ms.date: 05/25/2022
55
f1_keywords: ["C3502", "C3503", "C3504", "C3511", "C3512", "C3513", "C3514", "C3515", "C3516", "C3517", "C3518", "C3520", "C3521", "C3522", "C3523", "C3524", "C3525", "C3526", "C3527", "C3528", "C3529", "C3534", "C3542", "C3543", "C3544", "C3545", "C3546", "C3547", "C3548", "C3549", "C3557", "C3558", "C3559", "C3560", "C3561", "C3562", "C3563", "C3564", "C3565", "C3566", "C3567", "C3568", "C3569", "C3570", "C3571", "C3572", "C3573", "C3574", "C3575", "C3576", "C3577", "C3578", "C3579", "C3580", "C3581", "C3582", "C3583", "C3584", "C3585", "C3586", "C3587", "C3588", "C3589", "C3590", "C3591", "C3592", "C3593", "C3594", "C3595", "C3596", "C3597", "C3598", "C3599", "C3600", "C3601", "C3602", "C3604", "C3605", "C3606", "C3613", "C3614", "C3616", "C3617", "C3620", "C3621", "C3635", "C3636", "C3639", "C3643", "C3649", "C3658", "C3659", "C3660", "C3663", "C3664", "C3667", "C3674", "C3676", "C3677", "C3678", "C3679", "C3680", "C3681", "C3682", "C3683", "C3684", "C3685", "C3686", "C3687", "C3688", "C3689", "C3690", "C3691", "C3692", "C3693", "C3694", "C3695", "C3696", "C3700", "C3716", "C3720", "C3725", "C3726", "C3729", "C3730", "C3735", "C3742", "C3746", "C3750", "C3751", "C3756", "C3757", "C3758", "C3759", "C3760", "C3770", "C3773", "C3774", "C3775", "C3776", "C3777", "C3778", "C3780", "C3781", "C3782", "C3783", "C3784", "C3785", "C3786", "C3787", "C3788", "C3789", "C3790", "C3791", "C3792", "C3793", "C3794", "C3795", "C3796", "C3801", "C3802", "C3806", "C3810", "C3811", "C3814", "C3819", "C3822", "C3823", "C3826", "C3827", "C3829", "C3837", "C3840", "C3841", "C3843", "C3844", "C3845", "C3847", "C3863", "C3870", "C3871", "C3875", "C3876", "C3877", "C3878", "C3879", "C3881", "C3882", "C3884", "C3885", "C3897", "C3905", "C3906", "C3907", "C3916", "C3921", "C3924", "C3925", "C3926", "C3927", "C3928", "C3930", "C3931", "C3932", "C3933", "C3934", "C3935", "C3936", "C3937", "C3938", "C3939", "C3940", "C3941", "C3945", "C3946", "C3947", "C3948", "C3949", "C3950", "C3951", "C3952", "C3953", "C3954", "C3955", "C3956", "C3957", "C3958", "C3959", "C3960", "C3961", "C3962", "C3963", "C3964", "C3965", "C3966", "C3967", "C3968", "C3969", "C3970", "C3971", "C3972", "C3973", "C3974", "C3975", "C3976", "C3977", "C3978", "C3979", "C3980", "C3981", "C3982", "C3983", "C3984", "C3985", "C3986", "C3987", "C3988", "C3989", "C3990", "C3991", "C3992", "C3993", "C3994", "C3995", "C3996", "C3997", "C3998", "C3999"]
6-
ms.assetid: bd6f23ad-b300-4e07-8e35-9661cab1585f
76
---
87
# Compiler errors C3500 through C3999
98

10-
The articles in this section of the documentation explain a subset of the error messages that are generated by the compiler.
9+
The articles in this section explain a subset of the error messages generated by the compiler.
1110

1211
[!INCLUDE[error-boilerplate](../../error-messages/includes/error-boilerplate.md)]
1312

@@ -372,7 +371,7 @@ The articles in this section of the documentation explain a subset of the error
372371
|[Compiler error C3856](compiler-error-c3856.md)|'*class*': class is not a class template/generic|
373372
|[Compiler error C3857](compiler-error-c3857.md)|'*template*': multiple template/generic parameter lists are not allowed|
374373
|[Compiler error C3858](compiler-error-c3858.md)|'*identifier*': cannot be redeclared in current scope|
375-
|[Compiler error C3859](compiler-error-c3859.md)|virtual memory range for PCH exceeded; please recompile with a command line option of '`-Zm`*number*' or greater|
374+
|[Compiler error C3859](compiler-error-c3859.md)|Failed to create virtual memory for PCH|
376375
|[Compiler error C3860](compiler-error-c3860.md)|template/generic argument list following class template/generic name must list parameters in the order used in template/generic parameter list|
377376
|[Compiler error C3861](compiler-error-c3861.md)|'*identifier*': identifier not found|
378377
|[Compiler error C3862](compiler-error-c3862.md)|'*function*': cannot compile an unmanaged function with `/clr:pure` or `/clr:safe`|

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4002.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4002"
3-
title: "Compiler Warning (level 1) C4002"
2+
description: "Learn more about: Compiler Warning (level 1, Error) C4002"
3+
title: "Compiler Warning (level 1, Error) C4002"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4002"]
66
helpviewer_keywords: ["C4002"]
7-
ms.assetid: 6bda1dfe-e2e4-4771-9794-5a404c466dd5
87
---
9-
# Compiler Warning (level 1) C4002
8+
# Compiler Warning (level 1, Error) C4002
109

11-
too many actual parameters for macro 'identifier'
10+
> too many arguments for function-like macro invocation '*identifier*'
1211
1312
The number of actual parameters in the macro exceeds the number of formal parameters in the macro definition. The preprocessor collects the extra parameters but ignores them during macro expansion.
1413

15-
C4002 can occur when incorrectly using [Variadic Macros](../../preprocessor/variadic-macros.md).
14+
C4002 can occur when incorrectly using [variadic macros](../../preprocessor/variadic-macros.md).
1615

1716
The following sample generates C4002:
1817

@@ -32,7 +31,7 @@ int main() {
3231

3332
This error can also be generated as a result of compiler conformance work that was done for Visual Studio .NET 2003: extra commas in macro no longer accepted.
3433

35-
The compiler will no longer accept extra commas in a macro. For code to be valid in both the Visual Studio .NET 2003 and Visual Studio .NET versions of Visual C++, remove the extra commas.
34+
The compiler no longer accepts extra commas in a macro. For code to be valid in both the Visual Studio .NET 2003 and Visual Studio .NET versions of Visual C++, remove the extra commas.
3635

3736
```cpp
3837
// C4002b.cpp

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4003.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4003"
3-
title: "Compiler Warning (level 1) C4003"
2+
description: "Learn more about: Compiler Warning (level 1, Error) C4003"
3+
title: "Compiler Warning (level 1, Error) C4003"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4003"]
66
helpviewer_keywords: ["C4003"]
7-
ms.assetid: 0ed1c285-4428-4c90-8131-86897e31f115
87
---
9-
# Compiler Warning (level 1) C4003
8+
# Compiler Warning (level 1, Error) C4003
109

11-
not enough actual parameters for macro 'identifier'
10+
> not enough arguments for function-like macro invocation '*identifier*'
1211
1312
The number of formal parameters in the macro definition exceeds the number of actual parameters in the macro. Macro expansion substitutes empty text for the missing parameters.
1413

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4052.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4052"
3-
title: "Compiler Warning (level 1) C4052"
2+
description: "Learn more about: Compiler Warning (level 1 and level 4) C4052"
3+
title: "Compiler Warning (level 1 and level 4) C4052"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4052"]
66
helpviewer_keywords: ["C4052"]
7-
ms.assetid: f9955421-16ab-46e5-8f9d-bf1639a519ef
87
---
9-
# Compiler Warning (level 1) C4052
8+
# Compiler Warning (level 1 and level 4) C4052
109

11-
function declarations different; one contains variable arguments
10+
> function declarations different; one contains variable arguments
1211
13-
One declaration of the function does not contain variable arguments. It is ignored.
12+
One declaration of the function doesn't contain variable arguments. The empty declaration is ignored.
1413

1514
The following sample generates C4052:
1615

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4091.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4091"
3-
title: "Compiler Warning (level 1) C4091"
2+
description: "Learn more about: Compiler Warning (level 1 and level 2) C4091"
3+
title: "Compiler Warning (level 1 and level 2) C4091"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4091"]
66
helpviewer_keywords: ["C4091"]
7-
ms.assetid: 3a404967-ab42-49b0-b324-fd7ba1859d78
87
---
9-
# Compiler Warning (level 1) C4091
8+
# Compiler Warning (level 1 and level 2) C4091
109

11-
'keyword' : ignored on left of 'type' when no variable is declared
10+
> '*keyword*': ignored on left of '*type*' when no variable is declared
1211
13-
The compiler detected a situation where the user probably intended a variable to be declared, but the compiler was not able to declare the variable.
12+
The compiler detected a situation where the user probably intended a variable to be declared, but the compiler wasn't able to declare the variable.
1413

1514
## Examples
1615

@@ -29,7 +28,7 @@ __declspec(dllimport) class X2 {} varX;
2928
class __declspec(dllimport) X3 {};
3029
```
3130
32-
If an identifier is a typedef, it cannot also be a variable name. The following sample generates C4091.
31+
If an identifier is a typedef, it can't also be a variable name. The following sample generates C4091.
3332
3433
```cpp
3534
// C4091_b.cpp

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4141.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4141"
3-
title: "Compiler Warning (level 1) C4141"
2+
description: "Learn more about: Compiler Warning (level 1, Error) C4141"
3+
title: "Compiler Warning (level 1, Error) C4141"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4141"]
66
helpviewer_keywords: ["C4141"]
7-
ms.assetid: 6ce8c058-7f4c-41cf-93e7-90a466744656
87
---
9-
# Compiler Warning (level 1) C4141
8+
# Compiler Warning (level 1, Error) C4141
109

11-
'modifier' : used more than once
10+
> '*modifier*': used more than once
1211
1312
## Example
1413

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 2) C4007"
3-
title: "Compiler Warning (level 2) C4007"
2+
description: "Learn more about: Compiler Warning (level 3) C4007"
3+
title: "Compiler Warning (level 3) C4007"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4007"]
66
helpviewer_keywords: ["C4007"]
7-
ms.assetid: 56a70c07-59a5-4fd7-80ed-63592c65cbb7
87
---
9-
# Compiler Warning (level 2) C4007
8+
# Compiler Warning (level 3) C4007
109

11-
'function' : must be 'attribute'
10+
> '*function*': must be '*attribute*'
1211
13-
A required attribute for a function is not explicitly stated. For example, the function **main** must have the **`__cdecl`** attribute. The compiler forces the attribute.
12+
A required attribute for a function isn't explicitly stated. For example, the function `main` must have the `__cdecl` attribute. The compiler forces the attribute.

docs/error-messages/compiler-warnings/compiler-warning-level-3-c4101.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 3) C4101"
3-
title: "Compiler Warning (level 3) C4101"
2+
description: "Learn more about: Compiler Warning (level 3 and level 4) C4101"
3+
title: "Compiler Warning (level 3 and level 4) C4101"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4101"]
66
helpviewer_keywords: ["C4101"]
7-
ms.assetid: d98563cd-9dce-4aae-8f12-bd552a4ea677
87
---
9-
# Compiler Warning (level 3) C4101
8+
# Compiler Warning (level 3 and level 4) C4101
109

11-
'identifier' : unreferenced local variable
10+
> '*identifier*': unreferenced local variable
1211
13-
The local variable is never used. This warning will occur in the obvious situation:
12+
The local variable is never used. This warning occurs in the obvious situation:
1413

1514
```cpp
1615
// C4101a.cpp
@@ -20,7 +19,7 @@ int i; // C4101
2019
}
2120
```
2221

23-
However, this warning will also occur when calling a **`static`** member function through an instance of the class:
22+
However, this warning also occurs when calling a **`static`** member function through an instance of the class:
2423

2524
```cpp
2625
// C4101b.cpp
@@ -39,7 +38,7 @@ int main() {
3938
}
4039
```
4140
42-
In this situation, the compiler uses information about `si` to access the **`static`** function, but the instance of the class is not needed to call the **`static`** function; hence the warning. To resolve this warning, you could:
41+
In this situation, the compiler uses information about `si` to access the **`static`** function, but the instance of the class isn't needed to call the **`static`** function; hence the warning. To resolve this warning, you could:
4342
4443
- Add a constructor, in which the compiler would use the instance of `si` in the call to `func`.
4544
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 3) C4133"
3-
title: "Compiler Warning (level 3) C4133"
2+
description: "Learn more about: Compiler Warning (level 1 and level 3) C4133"
3+
title: "Compiler Warning (level 1 and level 3) C4133"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4133"]
66
helpviewer_keywords: ["C4133"]
7-
ms.assetid: bdef87b0-21b3-41ac-9b23-1fa86101a9ac
87
---
9-
# Compiler Warning (level 3) C4133
8+
# Compiler Warning (level 1 and level 3) C4133
109

11-
'type' : incompatible types - from 'type1' to 'type2'
10+
> '*expression*': incompatible types - from '*type1*' to '*type2*'
1211
13-
This warning can be caused by trying to subtract two pointers of different types.
12+
This warning is emitted when incompatible types are used in an expression. For example, doing arithmetic operations such as subtraction with different pointer types.
1413

1514
To avoid this warning, provide an appropriate type cast.

docs/error-messages/compiler-warnings/compiler-warning-level-3-c4191.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 3) C4191"
3-
title: "Compiler Warning (level 3) C4191"
2+
description: "Learn more about: Compiler Warning (level 3, off) C4191"
3+
title: "Compiler Warning (level 3, off) C4191"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4191"]
66
helpviewer_keywords: ["C4191"]
7-
ms.assetid: 576d3bc6-95b7-448a-af31-5d798452df09
87
---
9-
# Compiler Warning (level 3) C4191
8+
# Compiler Warning (level 3, off) C4191
109

11-
'operator/operation' : unsafe conversion from 'type of expression' to 'type required'
10+
> '*operation*': unsafe conversion from '*type_of_expression*' to '*type_required*'<br/>Making a function call using the resulting pointer may cause your program to fail
1211
1312
Several operations involving function pointers are considered unsafe:
1413

@@ -18,15 +17,15 @@ Several operations involving function pointers are considered unsafe:
1817

1918
- Argument or return types with different sizes, type categories, or classifications.
2019

21-
- Differing argument list lengths (on **`__cdecl`**, only on cast from longer list to shorter list, even if shorter is varargs).
20+
- Different argument list lengths (on **`__cdecl`**, only on cast from longer list to shorter list, even if shorter is varargs).
2221

23-
- Pointer to data (other than **`void`**<strong>\*</strong>) aliased against a pointer to function.
22+
- Pointer to data (other than **`void*`**) aliased against a pointer to function.
2423

2524
- Any other type difference that would yield an error or warning on a **`reinterpret_cast`**.
2625

2726
Calling this function through the result pointer might cause your program to crash.
2827

29-
This warning is off by default. See [Compiler Warnings That Are Off by Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md) for more information.
28+
This warning is off by default. For more information, see [Compiler Warnings That Are Off by Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md).
3029

3130
The following sample generates C4191:
3231

docs/error-messages/compiler-warnings/compiler-warning-level-4-c4001.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 4) C4001"
3-
title: "Compiler Warning (level 4) C4001"
2+
description: "Learn more about: Compiler Warning (level 4, no longer emitted) C4001"
3+
title: "Compiler Warning (level 4, no longer emitted) C4001"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4001"]
66
helpviewer_keywords: ["C4001"]
7-
ms.assetid: 414a47fe-d597-425e-9374-6a569231dc0a
87
---
9-
# Compiler Warning (level 4) C4001
8+
# Compiler Warning (level 4, no longer emitted) C4001
109

11-
nonstandard extension 'single line comment' was used
10+
> nonstandard extension 'single line comment' was used
1211
1312
> [!NOTE]
1413
> This warning is removed in Visual Studio 2017 version 15.5 because single-line comments are standard in C99.
1514
1615
Single-line comments are standard in C++ and standard in C starting with C99.
17-
Under strict ANSI compatibility ([/Za](../../build/reference/za-ze-disable-language-extensions.md)), C files that contain single-line comments, generate C4001 due to the usage of a nonstandard extension. Since single-line comments are standard in C++, C files containing single-line comments do not produce C4001 when compiling with Microsoft extensions (/Ze).
16+
Under strict ANSI compatibility ([/Za](../../build/reference/za-ze-disable-language-extensions.md)), C files that contain single-line comments, generate C4001 due to the usage of a nonstandard extension. Since single-line comments are standard in C++, C files containing single-line comments don't produce C4001 when compiling with Microsoft extensions (/Ze).
1817

1918
## Example
2019

0 commit comments

Comments
 (0)