Skip to content

Structure error references in range [C3131, C3160] #5664

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: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3131.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C3131"
title: "Compiler Error C3131"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3131"
ms.date: 11/04/2016
f1_keywords: ["C3131"]
helpviewer_keywords: ["C3131"]
ms.assetid: 38f20fac-83c9-4cd9-b7b5-74ca8f650ea6
---
# Compiler Error C3131

project must have a 'module' attribute with a 'name' property
> project must have a 'module' attribute with a 'name' property

## Remarks

The [module](../../windows/attributes/module-cpp.md) attribute must have a name parameter.

The following sample generates C3131:
## Example

The following example generates C3131:

```cpp
// C3131.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3132.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C3132"
title: "Compiler Error C3132"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3132"
ms.date: 11/04/2016
f1_keywords: ["C3132"]
helpviewer_keywords: ["C3132"]
ms.assetid: d54a3d12-336a-4ed0-ad4e-43cddac33b5e
---
# Compiler Error C3132

'function-parameter' : parameter arrays can only be applied to a formal argument of type 'single-dimensional managed array'
> 'function-parameter' : parameter arrays can only be applied to a formal argument of type 'single-dimensional managed array'

## Remarks

The <xref:System.ParamArrayAttribute> attribute was applied to a parameter that was not a single-dimension array.

The following sample generates C3132:
## Example

The following example generates C3132:

```cpp
// C3132.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3133.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3133"
title: "Compiler Error C3133"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3133"
ms.date: 11/04/2016
f1_keywords: ["C3133"]
helpviewer_keywords: ["C3133"]
ms.assetid: 4a709405-b67b-4061-8a2a-19fa5fb34a2a
---
# Compiler Error C3133

Attributes cannot be applied to C++ varargs
> Attributes cannot be applied to C++ varargs

## Remarks

An attribute was applied incorrectly. Attributes can not be applied to an ellipsis representing variable arguments.

For more information, see [User-Defined Attributes](../../extensions/user-defined-attributes-cpp-component-extensions.md).

## Example

The following sample generates C3133.
The following example generates C3133.

```cpp
// C3133.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3134.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3134"
title: "Compiler Error C3134"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3134"
ms.date: 11/04/2016
f1_keywords: ["C3134"]
helpviewer_keywords: ["C3134"]
ms.assetid: f887e4d2-7740-49e4-9972-7edceb8fa77b
---
# Compiler Error C3134

'value' : value of attribute argument 'attribute' does not have valid type 'type'
> 'value' : value of attribute argument 'attribute' does not have valid type 'type'

## Remarks

A syntax error was detected when a value was assigned to an attribute.

Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3135.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C3135"
title: "Compiler Error C3135"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3135"
ms.date: 11/04/2016
f1_keywords: ["C3135"]
helpviewer_keywords: ["C3135"]
ms.assetid: e92ee007-5a26-47f4-8ef4-339f2d9528d1
---
# Compiler Error C3135

'property' : a property cannot have a 'const' or 'volatile' type
> 'property' : a property cannot have a 'const' or 'volatile' type

## Remarks

The [const](../../cpp/const-cpp.md) and [volatile](../../cpp/volatile-cpp.md) keywords are not permitted on properties.
11 changes: 7 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3136.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
---
description: "Learn more about: Compiler Error C3136"
title: "Compiler Error C3136"
ms.date: "10/03/2018"
description: "Learn more about: Compiler Error C3136"
ms.date: 10/03/2018
f1_keywords: ["C3136"]
helpviewer_keywords: ["C3136"]
ms.assetid: c77103cd-00f7-408e-b74b-4f8562039d31
---
# Compiler Error C3136

'interface' : a COM interface can only inherit from another COM interface, 'interface' is not a COM interface
> 'interface' : a COM interface can only inherit from another COM interface, 'interface' is not a COM interface

## Remarks

An interface to which you applied an [interface attribute](../../windows/attributes/interface-attributes.md) inherits from an interface that is not a COM interface. A COM interface ultimately inherits from `IUnknown`. Any interface preceded by an interface attribute is a COM interface.

## Example

The following example generates C3136:

```cpp
Expand Down
11 changes: 7 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3137.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
---
description: "Learn more about: Compiler Error C3137"
title: "Compiler Error C3137"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3137"
ms.date: 11/04/2016
f1_keywords: ["C3137"]
helpviewer_keywords: ["C3137"]
ms.assetid: 70bb1313-2e87-43ed-a0d8-33fa6ff475e4
---
# Compiler Error C3137

'property' : a property cannot be initialized
> 'property' : a property cannot be initialized

## Remarks

A property cannot be initialized, for example, in a constructor's initialization list.

## Example

The following example generates C3137:

```cpp
Expand Down
11 changes: 7 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3138.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
---
description: "Learn more about: Compiler Error C3138"
title: "Compiler Error C3138"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3138"
ms.date: 11/04/2016
f1_keywords: ["C3138"]
helpviewer_keywords: ["C3138"]
ms.assetid: 364ee9e8-9358-410e-bd35-9c4a226a3753
---
# Compiler Error C3138

'interface' : a 'attribute' interface must inherit from IDispatch, or from an interface that inherits from IDispatch
> 'interface' : a 'attribute' interface must inherit from IDispatch, or from an interface that inherits from IDispatch

## Remarks

An interface with the [dual](../../windows/attributes/dual.md) or [dispinterface](../../windows/attributes/dispinterface.md) attributes does not have `IDispatch` as a direct or indirect base interface.

## Example

The following example generates C3138:

```cpp
Expand Down
15 changes: 10 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3139.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
---
description: "Learn more about: Compiler Error C3139"
title: "Compiler Error C3139"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3139"
ms.date: 11/04/2016
f1_keywords: ["C3139"]
helpviewer_keywords: ["C3139"]
ms.assetid: 95c92263-10ac-4ff3-b385-6312dd92adbc
---
# Compiler Error C3139

'struct' : cannot export a UDT without members
> 'struct' : cannot export a UDT without members

## Remarks

You attempted to apply the [export](../../windows/attributes/export.md) attribute to an empty UDT (user-defined type).

## Example

You attempted to apply the [export](../../windows/attributes/export.md) attribute to an empty UDT (user-defined type). For example:
For example:

```cpp
// C3139.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3140.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C3140"
title: "Compiler Error C3140"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3140"
ms.date: 11/04/2016
f1_keywords: ["C3140"]
helpviewer_keywords: ["C3140"]
ms.assetid: 122f8943-fac3-4db8-a3a8-2c5d19233de6
---
# Compiler Error C3140

cannot have multiple 'module' attributes in the same compilation unit
> cannot have multiple 'module' attributes in the same compilation unit

## Remarks

The [module](../../windows/attributes/module-cpp.md) attribute can only be defined once per project.

The following sample generates C3140:
## Example

The following example generates C3140:

```cpp
// C3140.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3141.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C3141"
title: "Compiler Error C3141"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3141"
ms.date: 11/04/2016
f1_keywords: ["C3141"]
helpviewer_keywords: ["C3141"]
ms.assetid: b4fd65c3-50cc-46cd-8de0-6a6d24cb9cda
---
# Compiler Error C3141

'interface_name' : interfaces only support public inheritance
> 'interface_name' : interfaces only support public inheritance

## Remarks

Interfaces defined with the [interface (or __interface)](../../cpp/interface.md) keyword only support public inheritance.

The following sample generates C3141:
## Example

The following example generates C3141:

```cpp
// C3141.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3142.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C3142"
title: "Compiler Error C3142"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3142"
ms.date: 11/04/2016
f1_keywords: ["C3142"]
helpviewer_keywords: ["C3142"]
ms.assetid: 795137ad-d00a-4a9c-9665-0cd8bfb5da8b
---
# Compiler Error C3142

'property_name' : you cannot take the address of a property
> 'property_name' : you cannot take the address of a property
## Remarks

The address of a property is not available to the developer.

The following sample generates C3142:
## Example

The following example generates C3142:

```cpp
// C3142_2.cpp
Expand Down
15 changes: 9 additions & 6 deletions docs/error-messages/compiler-errors-2/compiler-error-c3145.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C3145"
title: "Compiler Error C3145"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3145"
ms.date: 11/04/2016
f1_keywords: ["C3145"]
helpviewer_keywords: ["C3145"]
ms.assetid: f165c874-0f51-45c7-85e8-ebe321cbc168
---
# Compiler Error C3145

'object' : global or static variable may not have managed or WinRT type 'type'
> 'object' : global or static variable may not have managed or WinRT type 'type'

## Remarks

You can only define CLR or WinRT objects within function scope.

The following sample generates C3145 and shows how to fix it:
## Examples

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

```cpp
// C3145.cpp
Expand All @@ -35,7 +38,7 @@ int main() {
}
```

The following sample generates C3145:
The following example generates C3145:

```cpp
// C3145b.cpp
Expand Down
15 changes: 9 additions & 6 deletions docs/error-messages/compiler-errors-2/compiler-error-c3149.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
---
description: "Learn more about: Compiler Error C3149"
title: "Compiler Error C3149"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3149"
ms.date: 11/04/2016
f1_keywords: ["C3149"]
helpviewer_keywords: ["C3149"]
ms.assetid: cf6e2616-2f06-46da-8a8a-d449cb481c51
---
# Compiler Error C3149

'type' : cannot use this type here without a top-level 'char'
> 'type' : cannot use this type here without a top-level 'char'

## Remarks

A declaration was not specified correctly.

For example, you may have defined a CLR type at global scope and tried to create a variable of the type as part of the definition. Because global variables of CLR types are not allowed, the compiler will generate C3149.

To resolve this error, declare variables of CLR types inside a function or type definition.

The following sample generates C3149:
## Examples

The following example generates C3149:

```cpp
// C3149.cpp
Expand All @@ -29,7 +32,7 @@ int main() {
}
```

The following sample generates C3149:
The following example generates C3149:

```cpp
// C3149b.cpp
Expand Down
Loading