Skip to content

Commit 5366ab6

Browse files
authored
Merge pull request #3528 from TylerMSFT/twhitney-headerguard
change header guard
2 parents 424a1b3 + 66156d9 commit 5366ab6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docs/build/walkthrough-header-units.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,22 @@ In this example, you'll compile a header file as a header unit. Start by creatin
5555

5656
int main()
5757
{
58-
PrintPythogoreanTriple(2,3);
58+
PrintPythagoreanTriple(2,3);
5959
return 0;
6060
}
6161
```
6262
1. Add a header file called `Pythagorean.h`, and replace its content with this code:
6363
```cpp
64-
#pragma once
64+
#ifndef PYTHAGOREAN
65+
#define PYTHAGOREAN
66+
6567
#include <iostream>
6668

67-
void PrintPythogoreanTriple(int a, int b)
69+
void PrintPythagoreanTriple(int a, int b)
6870
{
6971
std::cout << "Pythagorean triple a:" << a << " b:" << b << " c:" << a*a + b*b << std::endl;
7072
}
73+
#endif
7174
```
7275

7376
To enable header units, first set the **C++ Language Standard** to [`/std:c++latest`](./reference/std-specify-language-standard-version.md).

0 commit comments

Comments
 (0)