diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2461.md b/docs/error-messages/compiler-errors-1/compiler-error-c2461.md index 4d3aac6503..7b4d94ac41 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2461.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2461.md @@ -1,22 +1,23 @@ --- -description: "Learn more about: Compiler Error C2461" title: "Compiler Error C2461" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2461" +ms.date: 11/04/2016 f1_keywords: ["C2461"] helpviewer_keywords: ["C2461"] -ms.assetid: e64ba651-f441-4fdb-b5cb-4209bbbe4db4 --- # Compiler Error C2461 > '*class*' : constructor syntax missing formal parameters +## Remarks + The constructor for the class does not specify any formal parameters. The declaration of a constructor must specify a formal parameter list. The list can be empty. To fix this issue, add a pair of parentheses after the declaration of *class*::**class*. ## Example -The following sample shows how to fix C2461: +The following example shows how to fix C2461: ```cpp // C2461.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2462.md b/docs/error-messages/compiler-errors-1/compiler-error-c2462.md index 9a8d3f1867..baad012150 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2462.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2462.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Error C2462" title: "Compiler Error C2462" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2462" +ms.date: 11/04/2016 f1_keywords: ["C2462"] helpviewer_keywords: ["C2462"] --- @@ -9,9 +9,13 @@ helpviewer_keywords: ["C2462"] > 'identifier' : cannot define a type in a 'new-expression' +## Remarks + You cannot define a type in the operand field of the **`new`** operator. Put the type definition in a separate statement. -The following sample generates C2462: +## Example + +The following example generates C2462: ```cpp // C2462.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2464.md b/docs/error-messages/compiler-errors-1/compiler-error-c2464.md index 15645af89f..10a9a5155f 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2464.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2464.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2464" title: "Compiler Error C2464" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2464" +ms.date: 11/04/2016 f1_keywords: ["C2464"] helpviewer_keywords: ["C2464"] -ms.assetid: ace953d6-b414-49ee-bfef-90578a8da00c --- # Compiler Error C2464 -'identifier' : cannot use 'new' to allocate a reference +> 'identifier' : cannot use 'new' to allocate a reference + +## Remarks A reference identifier was allocated with the **`new`** operator. References are not memory objects, so **`new`** cannot return a pointer to them. Use the standard variable declaration syntax to declare a reference. -The following sample generates C2464: +## Example + +The following example generates C2464: ```cpp // C2464.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2465.md b/docs/error-messages/compiler-errors-1/compiler-error-c2465.md index fc17301470..861458fb9e 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2465.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2465.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Error C2465" title: "Compiler Error C2465" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2465" +ms.date: 11/04/2016 f1_keywords: ["C2465"] helpviewer_keywords: ["C2465"] -ms.assetid: 65ba2a9f-d95e-4af3-b60b-1ac59a1e307c --- # Compiler Error C2465 -cannot define an anonymous type inside parentheses +> cannot define an anonymous type inside parentheses + +## Remarks An anonymous structure, union, or enumerated type is defined inside a parenthetical expression. This is invalid in C++ because the definition is meaningless in function scope. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2466.md b/docs/error-messages/compiler-errors-1/compiler-error-c2466.md index 34e0cca594..05985b61cb 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2466.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2466.md @@ -1,7 +1,7 @@ --- title: "Compiler Error C2466" description: "Learn more about: Compiler Error C2466" -ms.date: "03/19/2025" +ms.date: 03/19/2025 f1_keywords: ["C2466"] helpviewer_keywords: ["C2466"] --- @@ -9,9 +9,13 @@ helpviewer_keywords: ["C2466"] > cannot allocate an array of constant size 0 +## Remarks + An array is allocated or declared with size zero. The constant expression for the array size must be an integer greater than zero. An array declaration with a zero subscript is legal only for a class, structure, or union member and only with Microsoft extensions ([/Ze](../../build/reference/za-ze-disable-language-extensions.md)). -The following sample generates C2466: +## Example + +The following example generates C2466: ```cpp // C2466.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2467.md b/docs/error-messages/compiler-errors-1/compiler-error-c2467.md index 05d89f1289..a941568e44 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2467.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2467.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2467" title: "Compiler Error C2467" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2467" +ms.date: 11/04/2016 f1_keywords: ["C2467"] helpviewer_keywords: ["C2467"] -ms.assetid: f9ead270-5d0b-41cc-bdcd-586a647c67a7 --- # Compiler Error C2467 -illegal declaration of anonymous 'user-defined-type' +> illegal declaration of anonymous 'user-defined-type' + +## Remarks A nested user-defined type was declared. This is an error when compiling C source code with the ANSI compatibility option ([/Za](../../build/reference/za-ze-disable-language-extensions.md)) enabled. -The following sample generates C2467: +## Example + +The following example generates C2467: ```c //C2467.c diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2470.md b/docs/error-messages/compiler-errors-1/compiler-error-c2470.md index d0bc5eda5a..228392a8ef 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2470.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2470.md @@ -1,7 +1,7 @@ --- title: "Compiler Error C2470" description: "Learn more about: Compiler Error C2470" -ms.date: "03/29/2025" +ms.date: 03/29/2025 f1_keywords: ["C2470"] helpviewer_keywords: ["C2470"] --- @@ -9,6 +9,8 @@ helpviewer_keywords: ["C2470"] > '*function*': looks like a function definition, but there is no parameter list; skipping apparent body +## Remarks + A function definition is missing its argument list. ## Example diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2471.md b/docs/error-messages/compiler-errors-1/compiler-error-c2471.md index 062241d3ee..abf9f1606c 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2471.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2471.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Error C2471" title: "Compiler Error C2471" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2471" +ms.date: 11/04/2016 f1_keywords: ["C2471"] helpviewer_keywords: ["C2471"] -ms.assetid: a8928b44-20f6-4cbc-9aa5-7e86052a9c6b --- # Compiler Error C2471 -cannot update program database 'file' +> cannot update program database 'file' + +## Remarks The compiler cannot write to the database file. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2472.md b/docs/error-messages/compiler-errors-1/compiler-error-c2472.md index 7fce0f698a..0b322bc60c 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2472.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2472.md @@ -1,10 +1,9 @@ --- -description: "Learn more about: Compiler Error C2472" title: "Compiler Error C2472" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2472" +ms.date: 11/04/2016 f1_keywords: ["C2472"] helpviewer_keywords: ["C2472"] -ms.assetid: 3b36bcdc-2ba5-4357-ab88-7545ba0551cd --- # Compiler Error C2472 @@ -18,7 +17,7 @@ The **/clr:pure** and **/clr:safe** compiler options are deprecated in Visual St ## Example -The following sample generates C2472. +The following example generates C2472. ```cpp // C2472.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2473.md b/docs/error-messages/compiler-errors-1/compiler-error-c2473.md index 63eb9afabf..8577d69fad 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2473.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2473.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Error C2473" title: "Compiler Error C2473" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2473" +ms.date: 11/04/2016 f1_keywords: ["C2473"] helpviewer_keywords: ["C2473"] -ms.assetid: 6bb7dbf5-b198-490f-860e-fd64d0c2a284 --- # Compiler Error C2473 -'identifier' : looks like a function definition, but there is no parameter list. +> 'identifier' : looks like a function definition, but there is no parameter list. + +## Remarks The compiler detected what looked like a function, without the parameter list. ## Example -The following sample generates C2473. +The following example generates C2473. ```cpp // C2473.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2474.md b/docs/error-messages/compiler-errors-1/compiler-error-c2474.md index 939b72aa8e..a486d75c68 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2474.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2474.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Error C2474" title: "Compiler Error C2474" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2474" +ms.date: 11/04/2016 f1_keywords: ["C2474"] helpviewer_keywords: ["C2474"] -ms.assetid: 64e6c61e-6e77-480e-bcf0-b30a2fc482ac --- # Compiler Error C2474 -'keyword' : missing an adjacent semicolon, could be either keyword or identifier. +> 'keyword' : missing an adjacent semicolon, could be either keyword or identifier. + +## Remarks The compiler expected to find a semicolon, and was unable to determine your intent. Add the semicolon to resolve this error. ## Example -The following sample generates C2474. +The following example generates C2474. ```cpp // C2474.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2477.md b/docs/error-messages/compiler-errors-1/compiler-error-c2477.md index 9979cd6338..458ef4e497 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2477.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2477.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2477" title: "Compiler Error C2477" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2477" +ms.date: 11/04/2016 f1_keywords: ["C2477"] helpviewer_keywords: ["C2477"] -ms.assetid: 60bc324b-6605-4833-8099-a291efc712e7 --- # Compiler Error C2477 -'member' : static data member cannot be initialized via derived class +> 'member' : static data member cannot be initialized via derived class + +## Remarks A static data member of a template class was initialized incorrectly. This is a breaking change with versions of the Microsoft C++ compiler prior to Visual Studio .NET 2003, in order to conform to the ISO C++ standard. -The following sample generates C2477: +## Example + +The following example generates C2477: ```cpp // C2477.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2479.md b/docs/error-messages/compiler-errors-1/compiler-error-c2479.md index e7eca0e5cc..9f1401b354 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2479.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2479.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2479" title: "Compiler Error C2479" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2479" +ms.date: 11/04/2016 f1_keywords: ["C2479"] helpviewer_keywords: ["C2479"] -ms.assetid: c74c7869-e65b-4ca1-b6fa-eb39fed4458a --- # Compiler Error C2479 -'identifier' : 'allocate( )' is only valid for data items of static extent +> 'identifier' : 'allocate( )' is only valid for data items of static extent + +## Remarks The `__declspec( allocate())` syntax can be used for static data only. -The following sample generates C2479: +## Example + +The following example generates C2479: ```cpp // C2479.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2480.md b/docs/error-messages/compiler-errors-1/compiler-error-c2480.md index 53d4813194..669e3b97af 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2480.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2480.md @@ -1,20 +1,23 @@ --- -description: "Learn more about: Compiler Error C2480" title: "Compiler Error C2480" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2480" +ms.date: 11/04/2016 f1_keywords: ["C2480"] helpviewer_keywords: ["C2480"] -ms.assetid: 1a58d1c2-971b-4084-96fa-f94aa51c02f1 --- # Compiler Error C2480 -'identifier' : 'thread' is only valid for data items of static extent +> 'identifier' : 'thread' is only valid for data items of static extent + +## Remarks You cannot use the `thread` attribute with an automatic variable, nonstatic data member, function parameter, or on function declarations or definitions. Use the `thread` attribute for global variables, static data members, and local static variables only. -The following sample generates C2480: +## Example + +The following example generates C2480: ```cpp // C2480.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2482.md b/docs/error-messages/compiler-errors-1/compiler-error-c2482.md index 9c48b04b76..2e86bf038f 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2482.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2482.md @@ -1,10 +1,9 @@ --- -description: "Learn more about: Compiler Error C2482" title: "Compiler Error C2482" -ms.date: "09/15/2017" +description: "Learn more about: Compiler Error C2482" +ms.date: 09/15/2017 f1_keywords: ["C2482"] helpviewer_keywords: ["C2482"] -ms.assetid: 98c87da2-625c-4cc2-9bf7-78d15921e779 --- # Compiler Error C2482 @@ -16,7 +15,7 @@ In managed or WinRT code, variables declared by using the [__declspec(thread)](. ## Example -The following sample generates C2482 in managed (**/clr**) and in WinRT (**/ZW**) code: +The following example generates C2482 in managed (**/clr**) and in WinRT (**/ZW**) code: ```cpp // C2482.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2483.md b/docs/error-messages/compiler-errors-1/compiler-error-c2483.md index 5e225b8d6d..b150748d85 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2483.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2483.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Error C2483" title: "Compiler Error C2483" -ms.date: "09/15/2017" +description: "Learn more about: Compiler Error C2483" +ms.date: 09/15/2017 f1_keywords: ["C2483"] helpviewer_keywords: ["C2483"] -ms.assetid: 5762b325-914b-442d-a604-e4617ba04038 --- # Compiler Error C2483 >'*identifier*' : object with constructor or destructor cannot be declared 'thread' +## Remarks + This error message is obsolete in Visual Studio 2015 and later versions. In previous versions, variables declared with the `thread` attribute cannot be initialized with a constructor or other expression that requires run-time evaluation. A static expression is required to initialize `thread` data. ## Example -The following sample generates C2483 in Visual Studio 2013 and earlier versions. +The following example generates C2483 in Visual Studio 2013 and earlier versions. ```cpp // C2483.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2485.md b/docs/error-messages/compiler-errors-1/compiler-error-c2485.md index cc0fae6ad5..3dcdb343ff 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2485.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2485.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Error C2485" title: "Compiler Error C2485" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2485" +ms.date: 11/04/2016 f1_keywords: ["C2485"] helpviewer_keywords: ["C2485"] -ms.assetid: daae3fc1-76cf-4a6f-b2fa-86873fb0929d --- # Compiler Error C2485 -'identifier' : unrecognized extended attribute +> 'identifier' : unrecognized extended attribute + +## Remarks The declaration attribute is not valid. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2486.md b/docs/error-messages/compiler-errors-1/compiler-error-c2486.md index be3ef73366..6e59795950 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2486.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2486.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2486" title: "Compiler Error C2486" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2486" +ms.date: 11/04/2016 f1_keywords: ["C2486"] helpviewer_keywords: ["C2486"] -ms.assetid: 436da349-6461-4e32-bfca-4f3e620108e2 --- # Compiler Error C2486 -'__LOCAL_SIZE' only allowed in function with the 'naked' attribute +> '__LOCAL_SIZE' only allowed in function with the 'naked' attribute + +## Remarks In inline assembly functions, the name `__LOCAL_SIZE` is reserved for functions declared with the [naked](../../cpp/naked-cpp.md) attribute. -The following sample generates C2486: +## Example + +The following example generates C2486: ```cpp // C2486.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2487.md b/docs/error-messages/compiler-errors-1/compiler-error-c2487.md index 29a8a9beeb..360a49315c 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2487.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2487.md @@ -1,17 +1,21 @@ --- -description: "Learn more about: Compiler Error C2487" title: "Compiler Error C2487" -ms.date: "03/04/2024" +description: "Learn more about: Compiler Error C2487" +ms.date: 03/04/2024 f1_keywords: ["C2487"] helpviewer_keywords: ["C2487"] --- # Compiler Error C2487 -'identifier' : member of dll interface class may not be declared with dll interface +> 'identifier' : member of dll interface class may not be declared with dll interface + +## Remarks You can declare a whole class, or certain members of a non-DLL interface class, with DLL interface. You cannot declare a class with DLL interface and then declare a member of that class with DLL interface. -The following sample generates C2487: +## Example + +The following example generates C2487: ```cpp // C2487.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2488.md b/docs/error-messages/compiler-errors-1/compiler-error-c2488.md index 03afc72f64..f708e3c6c8 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2488.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2488.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2488" title: "Compiler Error C2488" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2488" +ms.date: 11/04/2016 f1_keywords: ["C2488"] helpviewer_keywords: ["C2488"] -ms.assetid: cd435909-43e4-43c6-a57c-5d02468ef75f --- # Compiler Error C2488 -'identifier' : 'naked' can only be applied to non-member function definitions +> 'identifier' : 'naked' can only be applied to non-member function definitions + +## Remarks The [naked](../../cpp/naked-cpp.md) attribute was applied to a function declaration. -The following sample generates C2488: +## Example + +The following example generates C2488: ```cpp // C2488.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2489.md b/docs/error-messages/compiler-errors-1/compiler-error-c2489.md index b7cdbc9ed0..fb1bc4c1b2 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2489.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2489.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2489" title: "Compiler Error C2489" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2489" +ms.date: 11/04/2016 f1_keywords: ["C2489"] helpviewer_keywords: ["C2489"] -ms.assetid: 67d8cd98-db7e-4f7f-86b4-4af7bc89ec8b --- # Compiler Error C2489 -'identifier' : initialized auto or register variable not allowed at function scope in 'naked' function +> 'identifier' : initialized auto or register variable not allowed at function scope in 'naked' function + +## Remarks For more information, see [naked](../../cpp/naked-cpp.md). -The following sample generates C2489: +## Example + +The following example generates C2489: ```cpp // C2489.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2490.md b/docs/error-messages/compiler-errors-1/compiler-error-c2490.md index b675d35c6b..56c30f37d3 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2490.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2490.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2490" title: "Compiler Error C2490" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2490" +ms.date: 11/04/2016 f1_keywords: ["C2490"] helpviewer_keywords: ["C2490"] -ms.assetid: 9de6bddd-b2e2-4ce6-b33b-201a8c2c8c54 --- # Compiler Error C2490 -'keyword' not allowed in function with 'naked' attribute +> 'keyword' not allowed in function with 'naked' attribute + +## Remarks A function defined as [naked](../../cpp/naked-cpp.md) cannot use structured exception handling. -The following sample generates C2490: +## Example + +The following example generates C2490: ```cpp // C2490.cpp