File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed
docs/error-messages/compiler-errors-2 Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
description : " Learn more about: Compiler Error C2526"
3
3
title : " Compiler Error C2526"
4
- ms.date : " 11/04/2016 "
4
+ ms.date : " 03/08/2024 "
5
5
f1_keywords : ["C2526"]
6
6
helpviewer_keywords : ["C2526"]
7
- ms.assetid : 0f8c554c-f990-457e-bcae-b6f273481825
8
7
---
9
8
# Compiler Error C2526
10
9
11
10
'identifier1' : C linkage function cannot return C++ class 'identifier2'
12
11
13
12
A function defined with C linkage cannot return a user-defined type.
13
+
14
+ The following sample generates C2526:
15
+
16
+ ``` cpp
17
+ // C2526.cpp
18
+ // compile with: /c
19
+ template <typename T>
20
+ class A {};
21
+
22
+ extern "C" A<int > func() // C2526
23
+ {
24
+ return A<int>();
25
+ }
26
+ ```
Original file line number Diff line number Diff line change 1
1
---
2
2
description : " Learn more about: Compiler Error C2537"
3
3
title : " Compiler Error C2537"
4
- ms.date : " 11/04/2016 "
4
+ ms.date : " 03/08/2024 "
5
5
f1_keywords : ["C2537"]
6
6
helpviewer_keywords : ["C2537"]
7
- ms.assetid : aee81d8e-300e-4a8b-b6c4-b3828398b34e
8
7
---
9
8
# Compiler Error C2537
10
9
11
10
'specifier' : illegal linkage specification
12
11
13
- Possible causes:
14
-
15
- 1 . The linkage specifier is not supported. Only the "C" linkage specifier is supported.
16
-
17
- 1 . "C" linkage is specified for more than one function in a set of overloaded functions. This is not allowed.
12
+ The linkage specifier is not supported. Only the "C" and "C++" linkage specifiers are supported.
18
13
19
14
The following sample generates C2537:
20
15
21
16
``` cpp
22
17
// C2537.cpp
23
18
// compile with: /c
24
- extern "c" void func (); // C2537
19
+ extern "c" void func1 (); // C2537
25
20
extern "C" void func2(); // OK
21
+ extern "C++" void func3(); // OK
26
22
```
You can’t perform that action at this time.
0 commit comments