Skip to content

Structure error references in range [C2201, C2230] #5561

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
6 changes: 4 additions & 2 deletions docs/error-messages/compiler-errors-1/compiler-error-c2201.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: "Learn more about: Compiler Error C2201"
title: "Compiler Error C2201"
description: "Learn more about: Compiler Error C2201"
ms.date: 05/03/2021
f1_keywords: ["C2201"]
helpviewer_keywords: ["C2201"]
Expand All @@ -9,11 +9,13 @@ helpviewer_keywords: ["C2201"]

> '*identifier*' : must have external linkage in order to be exported/imported

## Remarks

The exported identifier is **`static`**.

## Example

The following sample generates C2286, and shows how to fix it:
The following example generates C2286, and shows how to fix it:

```cpp
// C2201.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2203.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2203"
title: "Compiler Error C2203"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2203"
ms.date: 11/04/2016
f1_keywords: ["C2203"]
helpviewer_keywords: ["C2203"]
ms.assetid: 5497df43-86f6-43d5-b6cb-723c4c589b10
---
# Compiler Error C2203

delete operator cannot specify bounds for an array
> delete operator cannot specify bounds for an array

## Remarks

With the **/Za** (ANSI) option, the **`delete`** operator can delete an entire array but not parts or specific members of the array.

The following sample generates C2203:
## Example

The following example generates C2203:

```cpp
// C2203.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2204.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C2204"
title: "Compiler Error C2204"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2204"
ms.date: 11/04/2016
f1_keywords: ["C2204"]
helpviewer_keywords: ["C2204"]
ms.assetid: bbe506d4-7863-44af-8709-161881c4b4ba
---
# Compiler Error C2204

'type' : type definition found within parentheses
> 'type' : type definition found within parentheses

## Remarks

The type is defined as an operand or in prototype scope.
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2205.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C2205"
title: "Compiler Error C2205"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2205"
ms.date: 11/04/2016
f1_keywords: ["C2205"]
helpviewer_keywords: ["C2205"]
ms.assetid: bfc19840-4a48-4da5-8e69-7069989f1d2c
---
# Compiler Error C2205

'identifier' : cannot initialize extern variables with block scope
> 'identifier' : cannot initialize extern variables with block scope

## Remarks

An **`extern`** variable cannot be initialized in a function.
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2206.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2206"
title: "Compiler Error C2206"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2206"
ms.date: 11/04/2016
f1_keywords: ["C2206"]
helpviewer_keywords: ["C2206"]
ms.assetid: d7fba68b-aa28-4885-a9a0-27107358f066
---
# Compiler Error C2206

'function' : typedef cannot be used for function definition
> 'function' : typedef cannot be used for function definition

## Remarks

A **`typedef`** is used to define a function type.

The following sample generates C2206:
## Example

The following example generates C2206:

```cpp
// C2206.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2207.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C2207"
title: "Compiler Error C2207"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2207"
ms.date: 11/04/2016
f1_keywords: ["C2207"]
helpviewer_keywords: ["C2207"]
ms.assetid: d7d7b537-68f1-420a-9835-b5b6f2cb5cfd
---
# Compiler Error C2207

'member': a member of a class template cannot acquire a function type
> 'member': a member of a class template cannot acquire a function type

## Remarks

The `member` of the class template was previously parsed as a non-static data member. It cannot be redefined as a member function.
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2208.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2208"
title: "Compiler Error C2208"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2208"
ms.date: 11/04/2016
f1_keywords: ["C2208"]
helpviewer_keywords: ["C2208"]
ms.assetid: 9ae704bc-bf70-45f1-8e47-0470f21edd4e
---
# Compiler Error C2208

'type' : no members defined using this type
> 'type' : no members defined using this type

## Remarks

An identifier resolving to a type name is in an aggregate declaration, but the compiler cannot declare a member.

The following sample generates C2208:
## Example

The following example generates C2208:

```cpp
// C2208.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2212.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C2212"
title: "Compiler Error C2212"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2212"
ms.date: 11/04/2016
f1_keywords: ["C2212"]
helpviewer_keywords: ["C2212"]
ms.assetid: 3fdab304-272c-4d07-bfd4-fad75170e536
---
# Compiler Error C2212

'identifier' : __based not available for pointers to functions
> 'identifier' : __based not available for pointers to functions

## Remarks

Pointers to functions cannot be declared **`__based`**. If you need code-based data, use the **`__declspec`** keyword or the `data_seg` pragma.
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2213.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2213"
title: "Compiler Error C2213"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2213"
ms.date: 11/04/2016
f1_keywords: ["C2213"]
helpviewer_keywords: ["C2213"]
ms.assetid: ff012278-7f3b-4d49-aaed-2349756f6225
---
# Compiler Error C2213

'modifier' : illegal argument to __based
> 'modifier' : illegal argument to __based

## Remarks

The argument modifying **`__based`** is invalid.

The following sample generates C2213:
## Example

The following example generates C2213:

```cpp
// C2213.cpp
Expand Down
15 changes: 8 additions & 7 deletions docs/error-messages/compiler-errors-1/compiler-error-c2216.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Error C2216"
title: "Compiler Error C2216"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2216"
ms.date: 11/04/2016
f1_keywords: ["C2216"]
helpviewer_keywords: ["C2216"]
ms.assetid: 250f6bdc-a5e1-495f-a1e8-6e8e7021ad9d
---
# Compiler Error C2216

'keyword1' cannot be used with ' keyword2'
> 'keyword1' cannot be used with ' keyword2'

## Remarks

Two keywords that are mutually exclusive were used together.

## Examples

The following sample generates C2216.
The following example generates C2216.

```cpp
// C2216.cpp
Expand All @@ -25,7 +26,7 @@ ref struct Y1 {
};
```

The following sample generates C2216.
The following example generates C2216.

```cpp
// C2216b.cpp
Expand All @@ -36,7 +37,7 @@ public ref class X {
};
```

The following sample generates C2216.
The following example generates C2216.

```cpp
// C2216c.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-1/compiler-error-c2217.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Error C2217"
title: "Compiler Error C2217"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2217"
ms.date: 11/04/2016
f1_keywords: ["C2217"]
helpviewer_keywords: ["C2217"]
ms.assetid: 1ce1e3f5-4171-4376-804d-967f7e612935
---
# Compiler Error C2217

'attribute1' requires 'attribute2'
> 'attribute1' requires 'attribute2'

## Remarks

The first function attribute requires the second attribute.

## Example

C2217 can occur if you attempt to bind a delegate to a CLR function that takes a variable number of arguments. If the function also has a param array overload, use that instead. The following sample generates C2217.
C2217 can occur if you attempt to bind a delegate to a CLR function that takes a variable number of arguments. If the function also has a param array overload, use that instead. The following example generates C2217.

```cpp
// C2217.cpp
Expand Down
7 changes: 4 additions & 3 deletions docs/error-messages/compiler-errors-1/compiler-error-c2218.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
description: "Learn more about: Compiler Error C2218"
title: "Compiler Error C2218"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2218"
ms.date: 11/04/2016
f1_keywords: ["C2218"]
helpviewer_keywords: ["C2218"]
ms.assetid: b0f55da4-8edb-4b45-b298-1a091981bd7b
---
# Compiler Error C2218

> '__vectorcall' cannot be used with '/arch:IA32'

## Remarks

The **`__vectorcall`** calling convention is only supported in native code on x86 and x64 processors that include Streaming SIMD Extensions 2 (SSE2) and above. For more information, see [`__vectorcall`](../../cpp/vectorcall.md).

To fix this error, change the compiler options to target SSE2, AVX or AVX2 instruction sets. For more information, see [`/arch` (x86)](../../build/reference/arch-x86.md).
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2219.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C2219"
title: "Compiler Error C2219"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2219"
ms.date: 11/04/2016
f1_keywords: ["C2219"]
helpviewer_keywords: ["C2219"]
ms.assetid: 2cfe9a75-6890-46a1-a127-79a7def78e94
---
# Compiler Error C2219

syntax error : type qualifier must be after '*'
> syntax error : type qualifier must be after '*'

## Remarks

Type qualifier (**`const`** or **`volatile`**) appears where it is not permitted.
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2220.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C2220"
title: "Compiler Error C2220"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2220"
ms.date: 11/04/2016
f1_keywords: ["C2220"]
helpviewer_keywords: ["C2220"]
ms.assetid: d610802c-64d7-40ad-a2a6-0ed0b6815a6c
---
# Compiler Error C2220

warning treated as error - no object file generated
> warning treated as error - no object file generated

## Remarks

[/WX](../../build/reference/compiler-option-warning-level.md) tells the compiler to treat all warnings as errors. Because an error occurred, no object or executable file was generated.

Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2222.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C2222"
title: "Compiler Error C2222"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2222"
ms.date: 11/04/2016
f1_keywords: ["C2222"]
helpviewer_keywords: ["C2222"]
ms.assetid: 1c902054-5c77-41e6-a1cc-018f802460cd
---
# Compiler Error C2222

unexpected type 'type': a base-class or member was expected
> unexpected type 'type': a base-class or member was expected

## Remarks

The initializer list can only initialize base classes or members of a type. To fix this error, verify that only base classes or members of the type are initialized in the initializer list.
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2223.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C2223"
title: "Compiler Error C2223"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2223"
ms.date: 11/04/2016
f1_keywords: ["C2223"]
helpviewer_keywords: ["C2223"]
ms.assetid: e4506f0f-0317-4a96-8a90-877a156d7939
---
# Compiler Error C2223

left of '->identifier' must point to struct/union
> left of '->identifier' must point to struct/union

## Remarks

The operand to the left of `->` is not a pointer to a class, structure, or union.

Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-1/compiler-error-c2224.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C2224"
title: "Compiler Error C2224"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2224"
ms.date: 11/04/2016
f1_keywords: ["C2224"]
helpviewer_keywords: ["C2224"]
ms.assetid: 27b93bbf-4ce7-47a3-a9c4-f4fbed689bdf
---
# Compiler Error C2224

left of '.identifier' must have struct/union type
> left of '.identifier' must have struct/union type

## Remarks

The operand to the left of the period (.) is not a class, structure, or union.

Expand Down
Loading