Skip to content

Commit bd87d2e

Browse files
authored
Add example for C2129
1 parent 0f917d5 commit bd87d2e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,27 @@ static function 'function' declared but not defined
1313
A forward reference is made to a **`static`** function that is never defined.
1414

1515
A **`static`** function must be defined within file scope. If the function is defined in another file, it must be declared **`extern`**.
16+
17+
The following sample generates C2129:
18+
19+
```cpp
20+
// C2129.cpp
21+
static void foo(); // C2129
22+
23+
int main() {
24+
foo();
25+
}
26+
```
27+
28+
Possible resolution:
29+
30+
```cpp
31+
// C2129b.cpp
32+
static void foo();
33+
34+
int main() {
35+
foo();
36+
}
37+
38+
static void foo() {}
39+
```

0 commit comments

Comments
 (0)