Skip to content

Structure error references in range [C2001, C2020] #5517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions docs/error-messages/compiler-errors-1/compiler-error-c2001.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2002.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2003.md
Original file line number Diff line number Diff line change
@@ -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.
13 changes: 7 additions & 6 deletions docs/error-messages/compiler-errors-1/compiler-error-c2004.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2005.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 7 additions & 3 deletions docs/error-messages/compiler-errors-1/compiler-error-c2006.md
Original file line number Diff line number Diff line change
@@ -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 \<FILENAME>
> 'directive': expected "FILENAME" or \<FILENAME>

## 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
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2007.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2008.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 7 additions & 6 deletions docs/error-messages/compiler-errors-1/compiler-error-c2009.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2010.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2011.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
---
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.

You may also get C2011 if you import a header file or type library more than once into the same file. To prevent multiple inclusions of the types defined in a header file, use include guards or a `#pragma`[once](../../preprocessor/once.md) directive in the header file.

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
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2012.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2013.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2014.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading