diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2021.md b/docs/error-messages/compiler-errors-1/compiler-error-c2021.md index a32149660c..e0a6ce1831 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2021.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2021.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Error C2021" title: "Compiler Error C2021" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2021" +ms.date: 11/04/2016 f1_keywords: ["C2021"] helpviewer_keywords: ["C2021"] -ms.assetid: 064f32e2-3794-48d5-9767-991003dcb36a --- # Compiler Error C2021 -expected exponent value, not 'character' +> expected exponent value, not 'character' + +## Remarks The character used as the exponent of a floating-point constant is not a valid number. Be sure to use an exponent that is in range. -## Examples +## Example -The following sample generates C2021: +The following example generates C2021: ```cpp // C2021.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2022.md b/docs/error-messages/compiler-errors-1/compiler-error-c2022.md index a072ce76c2..619c126d66 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2022.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2022.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Error C2022" title: "Compiler Error C2022" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2022" +ms.date: 11/04/2016 f1_keywords: ["C2022"] helpviewer_keywords: ["C2022"] -ms.assetid: 1f5c477a-d909-42d8-8588-811586e8ba1e --- # Compiler Error C2022 -'number' : too big for character +> 'number' : too big for character + +## Remarks The octal number following a backslash (\\) in a character or string constant is too big to represent a character. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2023.md b/docs/error-messages/compiler-errors-1/compiler-error-c2023.md index ab9dba93d8..8ddc41ef91 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2023.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2023.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Compiler Error C2023" title: "Compiler Error C2023" +description: "Learn more about: Compiler Error C2023" ms.date: 08/18/2022 f1_keywords: ["C2023"] helpviewer_keywords: ["C2023"] @@ -9,11 +9,15 @@ helpviewer_keywords: ["C2023"] > '*identifier*': Alignment (*value-1*) different from prior declaration (*value-2*) +## Remarks + The compiler found an alignment specifier for a class type that's different from a previous declaration, or an **`enum`** alignment specifier that's different from the natural alignment of the base type. To resolve this error, make sure all declarations and definitions of the type use the same alignment value. -The following sample generates C2023: +## Example + +The following example generates C2023: ```cpp // C2023.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2024.md b/docs/error-messages/compiler-errors-1/compiler-error-c2024.md index fe0b5e057f..89965f73fe 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2024.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2024.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Compiler Error C2024" title: "Compiler Error C2024" +description: "Learn more about: Compiler Error C2024" ms.date: 08/18/2022 f1_keywords: ["C2024"] helpviewer_keywords: ["C2024"] @@ -9,11 +9,15 @@ helpviewer_keywords: ["C2024"] > 'alignas' attribute applies to variables, data members and tag types only +## Remarks + The compiler found an **`alignas`** specifier applied to a function or other type that can't be aligned. To resolve this error, remove the **`alignas`** specifier. -The following sample generates C2024: +## Example + +The following example generates C2024: ```cpp // C2024.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2025.md b/docs/error-messages/compiler-errors-1/compiler-error-c2025.md index 92c0e186ea..edd6d5218c 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2025.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2025.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Compiler Error C2025" title: "Compiler Error C2025" +description: "Learn more about: Compiler Error C2025" ms.date: 08/18/2022 f1_keywords: ["C2025"] helpviewer_keywords: ["C2025"] @@ -9,6 +9,8 @@ helpviewer_keywords: ["C2025"] > invalid or corrupted binary module interface file: '*filename*' +## Remarks + The compiler could not read the specified IFC file. To resolve this error, rebuild the module interface file. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2026.md b/docs/error-messages/compiler-errors-1/compiler-error-c2026.md index c04bbb7582..0ebf596eb0 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2026.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2026.md @@ -4,16 +4,15 @@ description: "Describes Microsoft C/C++ compiler error C2026, its causes and how ms.date: 09/25/2020 f1_keywords: ["C2026"] helpviewer_keywords: ["C2026"] -ms.assetid: 8e64b6e1-b967-479b-be97-d12dc4a8e389 --- # Compiler Error C2026 > string too big, trailing characters truncated -The string was longer than the limit of 16380 single-byte characters. - ## Remarks +The string was longer than the limit of 16380 single-byte characters. + Before adjacent strings get concatenated, a string can't be longer than 16380 single-byte characters. A Unicode string of about one half this length would also generate this error. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2027.md b/docs/error-messages/compiler-errors-1/compiler-error-c2027.md index d824942cd4..b99589dda0 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2027.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2027.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Error C2027" title: "Compiler Error C2027" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2027" +ms.date: 11/04/2016 f1_keywords: ["C2027"] helpviewer_keywords: ["C2027"] -ms.assetid: a39150c0-ec04-45ec-934c-a838bfe76627 --- # Compiler Error C2027 -use of undefined type 'type' +> use of undefined type 'type' + +## Remarks A type cannot be used until it is defined. To resolve the error, be sure the type is fully defined before referencing it. ## Examples -The following sample generates C2027. +The following example generates C2027. ```cpp // C2027.cpp @@ -36,7 +37,7 @@ int main() { It is possible to declare a pointer to a declared but undefined type. But C++ does not allow a reference to an undefined type. -The following sample generates C2027. +The following example generates C2027. ```cpp // C2027_b.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2028.md b/docs/error-messages/compiler-errors-1/compiler-error-c2028.md index dbf89a234a..d7adba707e 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2028.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2028.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Error C2028" title: "Compiler Error C2028" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2028" +ms.date: 11/04/2016 f1_keywords: ["C2028"] helpviewer_keywords: ["C2028"] -ms.assetid: 4e92e944-8fce-4443-9baf-4411ad9bde70 --- # Compiler Error C2028 -struct/union member must be inside a struct/union +> struct/union member must be inside a struct/union + +## Remarks Structure or union members must be declared within the structure or union. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2030.md b/docs/error-messages/compiler-errors-1/compiler-error-c2030.md index 6f355444f8..e13728eadd 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2030.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2030.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Error C2030" title: "Compiler Error C2030" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2030" +ms.date: 11/04/2016 f1_keywords: ["C2030"] helpviewer_keywords: ["C2030"] -ms.assetid: 5806cead-64df-4eff-92de-52c9a3f5ee62 --- # Compiler Error C2030 -a destructor with 'protected private' accessibility cannot be a member of a class declared 'sealed' +> a destructor with 'protected private' accessibility cannot be a member of a class declared 'sealed' + +## Remarks A Windows Runtime class declared as **`sealed`** cannot have a protected private destructor. Only public virtual and private non-virtual destructors are allowed on sealed types. For more information, see [Ref classes and structs](../../cppcx/ref-classes-and-structs-c-cx.md). diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2031.md b/docs/error-messages/compiler-errors-1/compiler-error-c2031.md index 737fec9789..f6ef1fa481 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2031.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2031.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Compiler Error C2031" title: "Compiler Error C2031" +description: "Learn more about: Compiler Error C2031" ms.date: 08/18/2022 f1_keywords: ["C2031"] helpviewer_keywords: ["C2031"] @@ -10,6 +10,8 @@ helpviewer_keywords: ["C2031"] > a virtual destructor with '*accessibility*' accessibility is not allowed for this type\ > a virtual destructor must have 'public' accessibility +## Remarks + A virtual Windows Runtime class has an access specifier or **`sealed`** specifier that's not allowed for a virtual destructor. For more information, see [Ref classes and structs](../../cppcx/ref-classes-and-structs-c-cx.md). To fix this error, change the accessibility of the destructor. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2032.md b/docs/error-messages/compiler-errors-1/compiler-error-c2032.md index 973fedfa7a..e2ed2b78c2 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2032.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2032.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2032" title: "Compiler Error C2032" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2032" +ms.date: 11/04/2016 f1_keywords: ["C2032"] helpviewer_keywords: ["C2032"] -ms.assetid: 625d7c83-70b6-42c2-a558-81fbc0026324 --- # Compiler Error C2032 -'identifier' : function cannot be member of struct/union 'structorunion' +> 'identifier' : function cannot be member of struct/union 'structorunion' + +## Remarks The structure or union has a member function, which is allowed in C++ but not in C. To resolve the error, either compile as a C++ program or remove the member function. -The following sample generates C2032: +## Example + +The following example generates C2032: ```c // C2032.c diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2033.md b/docs/error-messages/compiler-errors-1/compiler-error-c2033.md index 767ad97919..87aaa08b7b 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2033.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2033.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2033" title: "Compiler Error C2033" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2033" +ms.date: 11/04/2016 f1_keywords: ["C2033"] helpviewer_keywords: ["C2033"] -ms.assetid: fd5a1637-9db2-4c98-a7cc-b63b39737cd9 --- # Compiler Error C2033 -'identifier' : bit field cannot have indirection +> 'identifier' : bit field cannot have indirection + +## Remarks The bit field was declared as a pointer, which is not allowed. -The following sample generates C2033: +## Example + +The following example generates C2033: ```cpp // C2033.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2034.md b/docs/error-messages/compiler-errors-1/compiler-error-c2034.md index b512dc66b2..1f988de2b4 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2034.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2034.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2034" title: "Compiler Error C2034" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2034" +ms.date: 11/04/2016 f1_keywords: ["C2034"] helpviewer_keywords: ["C2034"] -ms.assetid: 953d70fa-bde9-4ce6-a55d-741e7bc63ff4 --- # Compiler Error C2034 -'identifier' : type of bit field too small for number of bits +> 'identifier' : type of bit field too small for number of bits + +## Remarks The number of bits in the bit-field declaration exceeds the size of the base type. -The following sample generates C2034: +## Example + +The following example generates C2034: ```cpp // C2034.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2035.md b/docs/error-messages/compiler-errors-1/compiler-error-c2035.md index 3b2f4c6fa8..8b4e5fe38b 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2035.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2035.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Compiler Error C2035" title: "Compiler Error C2035" +description: "Learn more about: Compiler Error C2035" ms.date: 08/18/2022 f1_keywords: ["C2035"] helpviewer_keywords: ["C2035"] @@ -10,6 +10,8 @@ helpviewer_keywords: ["C2035"] > a non-virtual destructor with '*accessibility*' accessibility is not allowed for this type\ > a non-virtual destructor must have 'protected private' or 'private' accessibility +## Remarks + A non-virtual Windows Runtime class has an access specifier or **`sealed`** specifier that's not allowed for a non-virtual destructor. For more information, see [Ref classes and structs](../../cppcx/ref-classes-and-structs-c-cx.md). To fix this error, change the accessibility of the destructor. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2036.md b/docs/error-messages/compiler-errors-1/compiler-error-c2036.md index 92350e0b5b..10f675360e 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2036.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2036.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Error C2036" title: "Compiler Error C2036" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2036" +ms.date: 11/04/2016 f1_keywords: ["C2036"] helpviewer_keywords: ["C2036"] -ms.assetid: 895821a9-65d1-44b5-bde1-dae827f3e486 --- # Compiler Error C2036 -'identifier' : unknown size +> 'identifier' : unknown size + +## Remarks An operation on `identifier` requires the size of the data object, which cannot be determined. ## Examples -The following sample generates C2036. +The following example generates C2036. ```c // C2036.c @@ -29,7 +30,7 @@ int main() { } ``` -The following sample generates C2036. +The following example generates C2036. ```cpp // C2036_2.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2037.md b/docs/error-messages/compiler-errors-1/compiler-error-c2037.md index ad11cf2dc6..04fffc4ba7 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2037.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2037.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Compiler Error C2037" title: "Compiler Error C2037" +description: "Learn more about: Compiler Error C2037" ms.date: 08/18/2022 f1_keywords: ["C2037"] helpviewer_keywords: ["C2037"] @@ -9,6 +9,8 @@ helpviewer_keywords: ["C2037"] > left of '*operator*' specifies undefined struct/union '*type*' +## Remarks + The operand to the left of the member-selection *operator* is not a fully defined class, structure, or union. This error can be caused by a left operand that is an undefined variable. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2038.md b/docs/error-messages/compiler-errors-1/compiler-error-c2038.md index 8e7ffa2aa0..4de865e57c 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2038.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2038.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Compiler Error C2038" title: "Compiler Error C2038" +description: "Learn more about: Compiler Error C2038" ms.date: 08/18/2022 f1_keywords: ["C2038"] helpviewer_keywords: ["C2038"] @@ -9,6 +9,8 @@ helpviewer_keywords: ["C2038"] > the std namespace cannot be inline +## Remarks + The C++ standard does not allow the `std` namespace to be declared `inline`. To resolve this issue, remove the `inline` specifier. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2039.md b/docs/error-messages/compiler-errors-1/compiler-error-c2039.md index 0264758359..635d97226b 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2039.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2039.md @@ -1,19 +1,21 @@ --- -description: "Learn more about: Compiler Error C2039" title: "Compiler Error C2039" -ms.date: "8/1/2023" +description: "Learn more about: Compiler Error C2039" +ms.date: 8/1/2023 f1_keywords: ["C2039"] helpviewer_keywords: ["C2039"] --- # Compiler Error C2039 -`'identifier1' : is not a member of 'identifier2'` +> 'identifier1' : is not a member of 'identifier2' + +## Remarks The code incorrectly calls or refers to a member of a structure, class, or union. ## Examples -The following sample generates C2039: +The following example generates C2039: ```cpp // C2039.cpp @@ -27,7 +29,7 @@ int main() { } ``` -The following sample generates C2039: +The following example generates C2039: ```cpp // C2039_b.cpp @@ -40,7 +42,7 @@ int main() { } ``` -The following sample generates C2039: +The following example generates C2039: ```cpp // C2039_c.cpp @@ -71,7 +73,7 @@ public class B { }; ``` -The following sample generates C2039 when it uses the previously defined C# component's default indexer incorrectly from C++/CLI: +The following example generates C2039 when it uses the previously defined C# component's default indexer incorrectly from C++/CLI: ```cpp // C2039_e.cpp @@ -88,7 +90,7 @@ int main() { } ``` -C2039 can also occur if you use generics. The following sample generates C2039: +C2039 can also occur if you use generics. The following example generates C2039: ```cpp // C2039_f.cpp @@ -113,7 +115,7 @@ int main() { C2039 can occur when you try to release managed or unmanaged resources. For more information, see [Destructors and finalizers](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Destructors_and_finalizers). -The following sample generates C2039: +The following example generates C2039: ```cpp // C2039_g.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2040.md b/docs/error-messages/compiler-errors-1/compiler-error-c2040.md index 76c71d13bb..ba66506a83 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2040.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2040.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2040" title: "Compiler Error C2040" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2040" +ms.date: 11/04/2016 f1_keywords: ["C2040"] helpviewer_keywords: ["C2040"] -ms.assetid: 74ca3592-1469-4965-ab34-a4815e2fbefe --- # Compiler Error C2040 -'operator' : 'identifier1' differs in levels of indirection from 'identifier2' +> 'operator' : 'identifier1' differs in levels of indirection from 'identifier2' + +## Remarks An expression involving the specified operands has incompatible operand types or implicitly converted operand types. If both operands are arithmetic, or both are nonarithmetic (such as array or pointer), they are used without change. If one operand is arithmetic and the other is not, the arithmetic operand is converted to the type of the nonarithmetic operand. -This sample generates C2040 and shows how to fix it. +## Example + +This example generates C2040 and shows how to fix it. ```cpp // C2040.cpp