Skip to content

Commit d74e13e

Browse files
Learn Build Service GitHub AppLearn Build Service GitHub App
authored andcommitted
Merging changes synced from https://github.com/MicrosoftDocs/cpp-docs-pr (branch live)
2 parents 872a222 + 535022e commit d74e13e

File tree

3 files changed

+100
-99
lines changed

3 files changed

+100
-99
lines changed

docs/error-messages/compiler-errors-1/compiler-error-c2039.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
---
22
description: "Learn more about: Compiler Error C2039"
33
title: "Compiler Error C2039"
4-
ms.date: "11/04/2016"
4+
ms.date: "8/1/2023"
55
f1_keywords: ["C2039"]
66
helpviewer_keywords: ["C2039"]
7-
ms.assetid: f9dfd521-9b36-4454-a69c-d63f45b606bb
87
---
98
# Compiler Error C2039
109

11-
'identifier1' : is not a member of 'identifier2'
10+
`'identifier1' : is not a member of 'identifier2'`
1211

1312
The code incorrectly calls or refers to a member of a structure, class, or union.
1413

1514
## Examples
1615

17-
The following sample generates C2039.
16+
The following sample generates C2039:
1817

1918
```cpp
2019
// C2039.cpp
@@ -28,7 +27,7 @@ int main() {
2827
}
2928
```
3029
31-
The following sample generates C2039.
30+
The following sample generates C2039:
3231
3332
```cpp
3433
// C2039_b.cpp
@@ -41,7 +40,7 @@ int main() {
4140
}
4241
```
4342

44-
The following sample generates C2039.
43+
The following sample generates C2039:
4544

4645
```cpp
4746
// C2039_c.cpp
@@ -57,9 +56,9 @@ int S::get_Count() { return 0; } // C2039
5756
int S::Count::get() { return 0; } // OK
5857
```
5958
60-
C2039 can also occur if you attempt to access a default indexer incorrectly. The following sample defines a component authored in C#.
59+
C2039 can also occur if you attempt to access a default indexer incorrectly. To demonstrate, this code defines a C# component that is used by the C++/CLI code that follows:
6160
62-
```
61+
```c#
6362
// C2039_d.cs
6463
// compile with: /target:library
6564
// a C# program
@@ -72,7 +71,7 @@ public class B {
7271
};
7372
```
7473

75-
The following sample generates C2039.
74+
The following sample generates C2039 when it uses the previously defined C# component's default indexer incorrectly from C++/CLI:
7675

7776
```cpp
7877
// C2039_e.cpp
@@ -89,7 +88,7 @@ int main() {
8988
}
9089
```
9190

92-
C2039 can also occur if you use generics. The following sample generates C2039.
91+
C2039 can also occur if you use generics. The following sample generates C2039:
9392

9493
```cpp
9594
// C2039_f.cpp
@@ -114,7 +113,7 @@ int main() {
114113
115114
C2039 can occur when you try to release managed or unmanaged resources. For more information, see [Destructors and finalizers](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Destructors_and_finalizers).
116115
117-
The following sample generates C2039.
116+
The following sample generates C2039:
118117
119118
```cpp
120119
// C2039_g.cpp

0 commit comments

Comments
 (0)