diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2001.md b/docs/error-messages/compiler-errors-1/compiler-error-c2001.md index b72f3b033c..6f34a4fc3d 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2001.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2001.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Error C2001" title: "Compiler Error C2001" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2001" +ms.date: 11/04/2016 f1_keywords: ["C2001"] helpviewer_keywords: ["C2001"] -ms.assetid: 0c3a7821-d8e5-4398-ab5a-4116d46e8dda --- # Compiler Error C2001 -newline in constant +> newline in constant + +## Remarks A string constant cannot be continued on a second line unless you do the following: @@ -18,9 +19,9 @@ A string constant cannot be continued on a second line unless you do the followi Ending the first line with \n is not sufficient. -## Examples +## Example -The following sample generates C2001: +The following example generates C2001: ```cpp // C2001.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2002.md b/docs/error-messages/compiler-errors-1/compiler-error-c2002.md index 70d299ecd6..418f0bc055 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2002.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2002.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Error C2002" title: "Compiler Error C2002" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2002" +ms.date: 11/04/2016 f1_keywords: ["C2002"] helpviewer_keywords: ["C2002"] -ms.assetid: 91982314-203a-4de1-b884-94e39a623f61 --- # Compiler Error C2002 -invalid wide-character constant +> invalid wide-character constant + +## Remarks The multibyte-character constant is not valid. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2003.md b/docs/error-messages/compiler-errors-1/compiler-error-c2003.md index 61d4e32b6b..2fbb892430 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2003.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2003.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Error C2003" title: "Compiler Error C2003" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2003" +ms.date: 11/04/2016 f1_keywords: ["C2003"] helpviewer_keywords: ["C2003"] -ms.assetid: 3161bc08-593d-4448-9fd3-4e3810be9e82 --- # Compiler Error C2003 -expected 'defined id' +> expected 'defined id' + +## Remarks An identifier must follow the preprocessor keyword. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2004.md b/docs/error-messages/compiler-errors-1/compiler-error-c2004.md index a17dba2cb4..18b687d027 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2004.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2004.md @@ -1,22 +1,23 @@ --- -description: "Learn more about: Compiler Error C2004" title: "Compiler Error C2004" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2004" +ms.date: 11/04/2016 f1_keywords: ["C2004"] helpviewer_keywords: ["C2004"] -ms.assetid: d81526dd-3a00-4593-87b0-d910d3d29bca --- # Compiler Error C2004 -expected 'defined(id)' +> expected 'defined(id)' + +## Remarks An identifier must appear in the parentheses following the preprocessor keyword. This error can also be generated as a result of compiler conformance work that was done for Visual Studio .NET 2003: missing parenthesis in preprocessor directive. If the closing parenthesis is missing from a preprocessor directive, the compiler will generate an error. -## Examples +## Example -The following sample generates C2004: +The following example generates C2004: ```cpp // C2004.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2005.md b/docs/error-messages/compiler-errors-1/compiler-error-c2005.md index 01f56d8c3f..d09db6738a 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2005.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2005.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2005" title: "Compiler Error C2005" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2005" +ms.date: 11/04/2016 f1_keywords: ["C2005"] helpviewer_keywords: ["C2005"] -ms.assetid: 090530ed-e0ec-4358-833a-ca24260e7ffe --- # Compiler Error C2005 -\#line expected a line number, found 'token' +> #line expected a line number, found 'token' + +## Remarks The `#line` directive must be followed by a line number. -The following sample generates C2005: +## Example + +The following example generates C2005: ```cpp // C2005.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2006.md b/docs/error-messages/compiler-errors-1/compiler-error-c2006.md index 531f672d9b..65c59918ff 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2006.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2006.md @@ -1,17 +1,21 @@ --- title: "Compiler Error C2006" description: "Learn more about: Compiler Error C2006" -ms.date: "01/28/2025" +ms.date: 01/28/2025 f1_keywords: ["C2006"] helpviewer_keywords: ["C2006"] --- # Compiler Error C2006 -'directive': expected "FILENAME" or \ +> 'directive': expected "FILENAME" or \ + +## Remarks Directives such as [#include](../../preprocessor/hash-include-directive-c-cpp.md) or [#import](../../preprocessor/hash-import-directive-cpp.md) require a filename. To resolve the error, ensure the filename is valid and enclosed in either double quotes or angle brackets. -The following sample generates C2006: +## Example + +The following example generates C2006: ```cpp // C2006.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2007.md b/docs/error-messages/compiler-errors-1/compiler-error-c2007.md index c34b64e788..e5831f153a 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2007.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2007.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2007" title: "Compiler Error C2007" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2007" +ms.date: 11/04/2016 f1_keywords: ["C2007"] helpviewer_keywords: ["C2007"] -ms.assetid: ecd09d99-5036-408b-9e46-bc15488f049e --- # Compiler Error C2007 -\#define syntax +> #define syntax + +## Remarks No identifier appears after a `#define`. To resolve the error, use an identifier. -The following sample generates C2007: +## Example + +The following example generates C2007: ```cpp // C2007.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2008.md b/docs/error-messages/compiler-errors-1/compiler-error-c2008.md index 3c0bc7b7c0..56451a8c67 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2008.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2008.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2008" title: "Compiler Error C2008" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2008" +ms.date: 11/04/2016 f1_keywords: ["C2008"] helpviewer_keywords: ["C2008"] -ms.assetid: e748ccbe-ffd4-4008-aca7-e53c25225209 --- # Compiler Error C2008 -'character' : unexpected in macro definition +> 'character' : unexpected in macro definition + +## Remarks The character appears immediately following the macro name. To resolve the error, there must be a space after the macro name. -The following sample generates C2008: +## Example + +The following example generates C2008: ```cpp // C2008.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2009.md b/docs/error-messages/compiler-errors-1/compiler-error-c2009.md index fe06f1de78..22d2909681 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2009.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2009.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Error C2009" title: "Compiler Error C2009" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2009" +ms.date: 11/04/2016 f1_keywords: ["C2009"] helpviewer_keywords: ["C2009"] -ms.assetid: fe9d94ed-20a5-4d83-b9c4-60ee69d2f30a --- # Compiler Error C2009 -reuse of macro formal 'identifier' +> reuse of macro formal 'identifier' + +## Remarks The formal parameter list of a macro definition uses the identifier more than once. Identifiers in the macro's parameter list must be unique. -## Examples +## Example -The following sample generates C2009: +The following example generates C2009: ```cpp // C2009.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2010.md b/docs/error-messages/compiler-errors-1/compiler-error-c2010.md index 0219901c98..2deeab992f 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2010.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2010.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2010" title: "Compiler Error C2010" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2010" +ms.date: 11/04/2016 f1_keywords: ["C2010"] helpviewer_keywords: ["C2010"] -ms.assetid: 5795ed1d-e206-410b-b7b4-528d125c67b4 --- # Compiler Error C2010 -'character' : unexpected in macro formal parameter list +> 'character' : unexpected in macro formal parameter list + +## Remarks The character is used incorrectly in the formal parameter list of a macro definition. Remove the character to resolve the error. -The following sample generates C2010: +## Example + +The following example generates C2010: ```cpp // C2010.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2011.md b/docs/error-messages/compiler-errors-1/compiler-error-c2011.md index f74c11a4a0..57533da7f9 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2011.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2011.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Error C2011" title: "Compiler Error C2011" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2011" +ms.date: 11/04/2016 f1_keywords: ["C2011"] helpviewer_keywords: ["C2011"] -ms.assetid: 992c9d51-e850-4d53-b86b-02e73b38249c --- # Compiler Error C2011 -'identifier' : 'type' type redefinition +> 'identifier' : 'type' type redefinition + +## Remarks The identifier was already defined as `type`. Check for redefinitions of the identifier. @@ -16,7 +17,9 @@ You may also get C2011 if you import a header file or type library more than onc If you need to find the initial declaration of the redefined type, you can use the [/P](../../build/reference/p-preprocess-to-a-file.md) compiler flag to generate the preprocessed output passed to the compiler. You can use text search tools to find instances of the redefined identifier in the output file. -The following sample generates C2011 and shows one way to fix it: +## Example + +The following example generates C2011 and shows one way to fix it: ```cpp // C2011.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2012.md b/docs/error-messages/compiler-errors-1/compiler-error-c2012.md index e186eb5de5..ef35628c05 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2012.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2012.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2012" title: "Compiler Error C2012" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2012" +ms.date: 11/04/2016 f1_keywords: ["C2012"] helpviewer_keywords: ["C2012"] -ms.assetid: 9f0d8162-c0b3-4234-a41f-836fdb75c84e --- # Compiler Error C2012 -missing name following '<' +> missing name following '<' + +## Remarks An `#include` directive lacks the required filename. -The following sample generates C2012: +## Example + +The following example generates C2012: ```cpp // C2012.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2013.md b/docs/error-messages/compiler-errors-1/compiler-error-c2013.md index 88d193210e..eeca87ca53 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2013.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2013.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2013" title: "Compiler Error C2013" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2013" +ms.date: 11/04/2016 f1_keywords: ["C2013"] helpviewer_keywords: ["C2013"] -ms.assetid: 6b5c955c-53da-48ee-8533-64ef5b905173 --- # Compiler Error C2013 -missing '>' +> missing '>' + +## Remarks An `#include` directive lacks a closing angle bracket. Add the closing bracket to resolve the error. -The following sample generates C2013: +## Example + +The following example generates C2013: ```cpp // C2013.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2014.md b/docs/error-messages/compiler-errors-1/compiler-error-c2014.md index b4369d4939..32eb37bf33 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2014.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2014.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2014" title: "Compiler Error C2014" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2014" +ms.date: 11/04/2016 f1_keywords: ["C2014"] helpviewer_keywords: ["C2014"] -ms.assetid: 231d8e9c-48c0-4027-99a3-245d186275ec --- # Compiler Error C2014 -preprocessor command must start as first nonwhite space +> preprocessor command must start as first nonwhite space + +## Remarks The `#` sign of a preprocessor directive must be the first character on a line that is not white space. -The following sample generates C2014: +## Example + +The following example generates C2014: ```cpp // C2014.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2015.md b/docs/error-messages/compiler-errors-1/compiler-error-c2015.md index 7c3cb4ed8e..060b5b60fb 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2015.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2015.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Error C2015" title: "Compiler Error C2015" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2015" +ms.date: 11/04/2016 f1_keywords: ["C2015"] helpviewer_keywords: ["C2015"] -ms.assetid: 8f40af0a-3a5a-4d6a-8ed7-125966e6bfed --- # Compiler Error C2015 -too many characters in constant +> too many characters in constant + +## Remarks A character constant contains more than two characters. The limit is one character for standard character constants and two characters for long character constants. @@ -16,7 +17,7 @@ An escape sequence, such as \t, is converted to a single character. ## Examples -The following sample generates C2015: +The following example generates C2015: ```cpp // C2015.cpp @@ -26,7 +27,7 @@ char test1 = 'error'; // C2015 char test2 = 'e'; // OK ``` -C2015 can also occur when using a Microsoft extension, character constants converted to integers. The following sample generates C2015: +C2015 can also occur when using a Microsoft extension, character constants converted to integers. The following example generates C2015: ```cpp // C2015b.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2016.md b/docs/error-messages/compiler-errors-1/compiler-error-c2016.md index 8e6379635a..563387c249 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2016.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2016.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Compiler Error C2016" title: "Compiler Error C2016" +description: "Learn more about: Compiler Error C2016" ms.date: 08/18/2022 f1_keywords: ["C2016"] helpviewer_keywords: ["C2016"] @@ -9,6 +9,8 @@ helpviewer_keywords: ["C2016"] > C requires that a struct or union has at least one member +## Remarks + The compiler found a **`struct`** or **`union`** defined with no members, which isn't allowed in C. For more information, see [Structures](../../c-language/structure-declarations.md) and [Unions](../../c-language/union-declarations.md). To resolve this error, create at least one member in your **`struct`** or **`union`**. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2017.md b/docs/error-messages/compiler-errors-1/compiler-error-c2017.md index fc2705d40d..d659ba2526 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2017.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2017.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2017" title: "Compiler Error C2017" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2017" +ms.date: 11/04/2016 f1_keywords: ["C2017"] helpviewer_keywords: ["C2017"] -ms.assetid: 1083eed9-9906-4a97-883c-54e52d7e82cd --- # Compiler Error C2017 -illegal escape sequence +> illegal escape sequence + +## Remarks An escape sequence, such as \t, appears outside of a character or string constant. -The following sample generates C2017: +## Examples + +The following example generates C2017: ```cpp // C2017.cpp @@ -24,7 +27,7 @@ int main() { C2017 can occur when the stringize operator is used with strings that include escape sequences. -The following sample generates C2017: +The following example generates C2017: ```cpp // C2017b.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2019.md b/docs/error-messages/compiler-errors-1/compiler-error-c2019.md index 8353a05ae6..e835a04252 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2019.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2019.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2019" title: "Compiler Error C2019" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2019" +ms.date: 11/04/2016 f1_keywords: ["C2019"] helpviewer_keywords: ["C2019"] -ms.assetid: 4f37b1e1-9eca-418f-a4c3-141e8512d7b6 --- # Compiler Error C2019 -expected preprocessor directive, found 'character' +> expected preprocessor directive, found 'character' + +## Remarks The character followed a `#` sign but it is not the first letter of a preprocessor directive. -The following sample generates C2019: +## Example + +The following example generates C2019: ```cpp // C2019.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2020.md b/docs/error-messages/compiler-errors-1/compiler-error-c2020.md index 1d9ecbc494..bc32e9e64c 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2020.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2020.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Error C2020" title: "Compiler Error C2020" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2020" +ms.date: 11/04/2016 f1_keywords: ["C2020"] helpviewer_keywords: ["C2020"] -ms.assetid: 486f98ed-6574-4d82-89e3-74b5a61ed419 --- # Compiler Error C2020 -'member' : 'class' member redefinition +> 'member' : 'class' member redefinition + +## Remarks A member inherited from a base class or structure is redefined. Inherited members cannot be redefined unless declared as **`virtual`** in the base class.