Skip to content

Commit 44830a0

Browse files
authored
Merge pull request MicrosoftDocs#1872 from corob-msft/cr-766
Add example to /link option for 766
2 parents 79a0c71 + 8691a68 commit 44830a0

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

docs/build/reference/link-pass-options-to-linker.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "/link (Pass Options to Linker)"
3-
ms.date: "11/04/2016"
3+
ms.date: "03/25/2019"
44
f1_keywords: ["/link"]
55
helpviewer_keywords: ["/link compiler option [C++]", "pass options to linker", "link compiler option [C++]", "linker [C++], passing options to", "-link compiler option [C++]", "cl.exe compiler [C++], passing options to linker"]
66
ms.assetid: 16902a94-c094-4328-841f-3ac94ca04848
@@ -11,32 +11,36 @@ Passes one or more linker options to the linker.
1111

1212
## Syntax
1313

14-
```
15-
/link linkeroptions
16-
```
14+
> **/link** *linker-options*
1715
1816
## Arguments
1917

20-
*linkeroptions*<br/>
18+
*linker-options*<br/>
2119
The linker option or options to be passed to the linker.
2220

2321
## Remarks
2422

2523
The **/link** option and its linker options must appear after any file names and CL options. A space is required between **/link** and `linkeroptions`. For more information, see [MSVC linker reference](linking.md).
2624

25+
## Example
26+
27+
This sample command line compiles *hello.cpp* and links it to the existing object file *there.obj*. It then passes an additional **/VERSION** command to the linker:
28+
29+
`cl /W4 /EHsc hello.cpp there.obj /link /VERSION:3.14`
30+
2731
### To set this compiler option in the Visual Studio development environment
2832

29-
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
33+
The IDE normally sends separate commands to compile and link your code. You can set linker options in your project property pages.
3034

31-
1. Click the **Linker** folder.
35+
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
3236

33-
1. Click a linker property page.
37+
1. Select the **Configuration Properties** > **Linker** folder.
3438

35-
1. Modify one or more properties.
39+
1. Modify one or more properties. Choose **OK** to save your changes.
3640

3741
### To set this compiler option programmatically
3842

39-
- This compiler option cannot be changed programmatically.
43+
- This compiler option can't be changed programmatically.
4044

4145
## See also
4246

0 commit comments

Comments
 (0)