Skip to content

Commit fc527f0

Browse files
author
Colin Robertson
committed
Try fix for xref link.
1 parent 930d139 commit fc527f0

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

docs/build/reference/dot-lib-files-as-linker-input.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,39 +45,36 @@ translation.priority.ht:
4545
# .Lib Files as Linker Input
4646
LINK accepts COFF standard libraries and COFF import libraries, both of which usually have the extension .lib. Standard libraries contain objects and are created by the LIB tool. Import libraries contain information about exports in other programs and are created either by LINK when it builds a program that contains exports or by the LIB tool. For information on using LIB to create standard or import libraries, see [LIB Reference](../../build/reference/lib-reference.md). For details on using LINK to create an import library, see the [/DLL](../../build/reference/dll-build-a-dll.md) option.
4747

48-
A library is specified to LINK as either a file name argument or a default library. LINK resolves external references by searching first in libraries specified on the command line, then in default libraries specified with the [/DEFAULTLIB](../../build/reference/defaultlib-specify-default-library.md) option, and then in default libraries named in .obj files. If a path is specified with the library name, LINK looks for the library in that directory. If no path is specified, LINK looks first in the directory that LINK is running from, and then in any directories specified in the LIB environment variable.
48+
A library is specified to LINK as either a file name argument or a default library. LINK resolves external references by searching first in libraries specified on the command line, then in default libraries specified with the [/DEFAULTLIB](../../build/reference/defaultlib-specify-default-library.md) option, and then in default libraries named in .obj files. If a path is specified with the library name, LINK looks for the library in that directory. If no path is specified, LINK looks first in the directory that LINK is running from, and then in any directories specified in the LIB environment variable.
4949

50-
### To add .lib files as linker input in the development environment
50+
## To add .lib files as linker input in the development environment
5151

5252
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
5353

54-
2. Click the **Linker** folder.
54+
2. Choose the **Input** property page in the **Linker** folder.
5555

56-
3. Click the **Input** property page.
56+
3. Modify the **Additional Dependencies** property to add the .lib files.
5757

58-
4. Modify the **Additional Dependencies** property.
58+
## To programmatically add .lib files as linker input
5959

60-
### To programmatically add .lib files as linker input
61-
62-
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalDependencies>.
60+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalDependencies%2A>.
6361

6462
## Example
65-
The following sample shows how to build and use a .lib file:
63+
The following sample shows how to build and use a .lib file. First, build a .lib file:
6664

67-
```
65+
```cpp
6866
// lib_link_input_1.cpp
69-
// compile with: /LD
67+
// compile by using: cl /LD lib_link_input_1.cpp
7068
__declspec(dllexport) int Test() {
7169
return 213;
7270
}
7371
```
7472
75-
## Example
76-
And then:
73+
And then, compile this sample by using the .lib file you just created:
7774
78-
```
75+
```cpp
7976
// lib_link_input_2.cpp
80-
// compile with: /EHsc lib_link_input_1.lib
77+
// compile by using: cl /EHsc lib_link_input_1.lib lib_link_input_2.cpp
8178
__declspec(dllimport) int Test();
8279
#include <iostream>
8380
int main() {

0 commit comments

Comments
 (0)