Skip to content

Structure error references in range [C3161, C3190] #5666

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
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3161.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Error C3161"
title: "Compiler Error C3161"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3161"
ms.date: 11/04/2016
f1_keywords: ["C3161"]
helpviewer_keywords: ["C3161"]
ms.assetid: 1fe2be85-a343-487b-8476-bf9e257eb29d
---
# Compiler Error C3161

'interface' : nesting class, struct, union or interface in an interface is illegal; nesting interface in a class, struct or union is illegal
> 'interface' : nesting class, struct, union or interface in an interface is illegal; nesting interface in a class, struct or union is illegal

## Remarks

An [__interface](../../cpp/interface.md) can only appear at global scope or within a namespace. A class, struct, or union cannot appear in an interface.

## Example

The following sample generates C3161.
The following example generates C3161.

```cpp
// C3161.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3162.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3162"
title: "Compiler Error C3162"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3162"
ms.date: 11/04/2016
f1_keywords: ["C3162"]
helpviewer_keywords: ["C3162"]
ms.assetid: 0d4c4a24-1456-4191-b7d8-c38cb7b17c32
---
# Compiler Error C3162

'type' : a reference type which has a destructor cannot be used as the type of static data member 'member'
> 'type' : a reference type which has a destructor cannot be used as the type of static data member 'member'

## Remarks

The common language runtime cannot know when to run a user-defined destructor when the class also contains static member function.

Expand All @@ -22,7 +23,7 @@ For more information, see,

## Example

The following sample generates C3162.
The following example generates C3162.

```cpp
// C3162.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3163.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
description: "Learn more about: Compiler Error C3163"
title: "Compiler Error C3163"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3163"
ms.date: 11/04/2016
f1_keywords: ["C3163"]
helpviewer_keywords: ["C3163"]
ms.assetid: 17dcafa3-f416-4e04-a232-f9569218ba75
---
# Compiler Error C3163

> '*construct*': attributes inconsistent with previous declaration

## Remarks

The attribute(s) that are applied to a definition conflict with the attribute(s) that are applied to a declaration.

One way to resolve C3163 is to eliminate attributes on the forward declaration. Any attributes on a forward declaration should be less than the attributes on the definition or, at most, equal to them.
Expand All @@ -18,7 +19,7 @@ A possible cause of the C3163 error involves the Microsoft source code annotatio

## Example

The following sample generates C3163.
The following example generates C3163.

```cpp
// C3163.cpp
Expand Down
7 changes: 4 additions & 3 deletions docs/error-messages/compiler-errors-2/compiler-error-c3166.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
description: "Learn more about: Compiler Error C3166"
title: "Compiler Error C3166"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3166"
ms.date: 11/04/2016
f1_keywords: ["C3166"]
helpviewer_keywords: ["C3166"]
ms.assetid: ec3e330d-c15d-4158-8268-09101486c566
---
# Compiler Error C3166

> 'pointer' : cannot declare a pointer to an interior __gc pointer as a member of 'type'

## Remarks

The compiler found an invalid pointer declaration (a **`__nogc`** pointer to a **`__gc`** pointer.).

C3166 is only reachable using the obsolete compiler option **`/clr:oldSyntax`**.
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3167.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C3167"
title: "Compiler Error C3167"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3167"
ms.date: 11/04/2016
f1_keywords: ["C3167"]
helpviewer_keywords: ["C3167"]
ms.assetid: 58c25fe7-8562-4a18-ad3f-487f081ff173
---
# Compiler Error C3167

Unable to initialize .NET Framework: make sure it is installed
> Unable to initialize .NET Framework: make sure it is installed

## Remarks

The .NET Framework is not installed on this computer; install the .NET Framework.
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3168.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C3168"
title: "Compiler Error C3168"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3168"
ms.date: 11/04/2016
f1_keywords: ["C3168"]
helpviewer_keywords: ["C3168"]
ms.assetid: 4c36fcfb-c351-48ff-b4eb-78d2aa1b4d55
---
# Compiler Error C3168

'type' : illegal underlying type for enum
> 'type' : illegal underlying type for enum

## Remarks

The underlying type you specified for the **`enum`** type was not valid. The underlying type must be an integral C++ type or a corresponding CLR type.

The following sample generates C3168:
## Example

The following example generates C3168:

```cpp
// C3168.cpp
Expand Down
11 changes: 7 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3170.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
---
description: "Learn more about: Compiler Error C3170"
title: "Compiler Error C3170"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3170"
ms.date: 11/04/2016
f1_keywords: ["C3170"]
helpviewer_keywords: ["C3170"]
ms.assetid: ca9a59d6-7df3-42f0-b028-c09d0af3ac2a
---
# Compiler Error C3170

cannot have different module identifiers in a project
> cannot have different module identifiers in a project

## Remarks

[module](../../windows/attributes/module-cpp.md) attributes with different names were found in two of the files in a compilation. Only one unique `module` attribute can be specified per compilation.

Identical `module` attributes can be specified in more than one source code file.

## Example

For example, if the following module attributes were found:

```cpp
Expand Down
11 changes: 7 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3171.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
---
description: "Learn more about: Compiler Error C3171"
title: "Compiler Error C3171"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3171"
ms.date: 11/04/2016
f1_keywords: ["C3171"]
helpviewer_keywords: ["C3171"]
ms.assetid: 1ce26997-7ef1-4c9f-84da-003ea1a4251e
---
# Compiler Error C3171

'module': cannot specify different module attributes in a project
> 'module': cannot specify different module attributes in a project

## Remarks

[module](../../windows/attributes/module-cpp.md) attributes with different parameter lists were found in two of the files in a compilation. Only one unique `module` attribute can be specified per compilation.

Identical `module` attributes can be specified in more than one source code file.

## Example

For example, if the following `module` attributes were found:

```cpp
Expand Down
11 changes: 7 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3172.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
---
description: "Learn more about: Compiler Error C3172"
title: "Compiler Error C3172"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3172"
ms.date: 11/04/2016
f1_keywords: ["C3172"]
helpviewer_keywords: ["C3172"]
ms.assetid: 1834e2fd-6036-4c33-aff2-b51bc7c99441
---
# Compiler Error C3172

'module_name': cannot specify different idl_module attributes in a project
> 'module_name': cannot specify different idl_module attributes in a project

## Remarks

[idl_module](../../windows/attributes/idl-module.md) attributes with the same name but different `dllname` or `version` parameters were found in two of the files in a compilation. Only one unique `idl_module` attribute can be specified per compilation.

Identical `idl_module` attributes can be specified in more than one source code file.

## Example

For example, if the following `idl_module` attributes were found:

```cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3173.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3173"
title: "Compiler Error C3173"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3173"
ms.date: 11/04/2016
f1_keywords: ["C3173"]
helpviewer_keywords: ["C3173"]
ms.assetid: edf79e10-e8cf-4f76-8d33-ab9d05e974e9
---
# Compiler Error C3173

version mismatch in idl merge
> version mismatch in idl merge

## Remarks

This error occurs when an object file contains embedded idl that was generated with a previous version of the compiler. The compiler encodes a version number to ensure that the same compiler used to generate the idl content that is embedded in the .obj files is also the same compiler used to merge the embedded idl.

Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3174.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C3174"
title: "Compiler Error C3174"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3174"
ms.date: 11/04/2016
f1_keywords: ["C3174"]
helpviewer_keywords: ["C3174"]
ms.assetid: fe6b3b5a-8196-485f-a45f-0b2e51df4086
---
# Compiler Error C3174

module attribute was not specified
> module attribute was not specified

## Remarks

A program that uses Visual C++ attributes did not also use the [module](../../windows/attributes/module-cpp.md) attribute, which is required in any program that uses attributes.

The following sample generates C3174:
## Example

The following example generates C3174:

```cpp
// C3174.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3175.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C3175"
title: "Compiler Error C3175"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3175"
ms.date: 11/04/2016
f1_keywords: ["C3175"]
helpviewer_keywords: ["C3175"]
ms.assetid: 3f19d513-a05a-4b6c-806f-276fe5c36b90
---
# Compiler Error C3175

'function1' : cannot call a method of a managed type from unmanaged function 'function2'
> 'function1' : cannot call a method of a managed type from unmanaged function 'function2'

## Remarks

Unmanaged functions cannot call member functions of managed classes.

The following sample generates C3175:
## Example

The following example generates C3175:

```cpp
// C3175_2.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3176.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Error C3176"
title: "Compiler Error C3176"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3176"
ms.date: 11/04/2016
f1_keywords: ["C3176"]
helpviewer_keywords: ["C3176"]
ms.assetid: 6cc8d602-8e15-47a7-b1b5-e93e5d50e271
---
# Compiler Error C3176

'type' : cannot declare local value type
> 'type' : cannot declare local value type

## Remarks

A class can only be declared as a value type at global scope.

## Example

The following sample generates C3176.
The following example generates C3176.

```cpp
// C3176.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3179.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C3179"
title: "Compiler Error C3179"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3179"
ms.date: 11/04/2016
f1_keywords: ["C3179"]
helpviewer_keywords: ["C3179"]
ms.assetid: 60d7e41b-25fd-48ac-8b79-830c062f4dcd
---
# Compiler Error C3179

an unnamed managed or WinRT type is not allowed
> an unnamed managed or WinRT type is not allowed

## Remarks

All CLR and WinRT classes and structs must have names.

The following sample generates C3179 and shows how to fix it:
## Example

The following example generates C3179 and shows how to fix it:

```cpp
// C3179a.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3180.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3180"
title: "Compiler Error C3180"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3180"
ms.date: 11/04/2016
f1_keywords: ["C3180"]
helpviewer_keywords: ["C3180"]
ms.assetid: 5281f583-7df7-418a-8507-d4da67ed6572
---
# Compiler Error C3180

'type name' : name exceeds meta-data limit of 'limit' characters
> 'type name' : name exceeds meta-data limit of 'limit' characters

## Remarks

The compiler truncated the name for a managed type in metadata. The truncation will make the type unusable with the `#using` directive (or the equivalent in another language).

Expand Down
Loading