Редагувати

Поділитися через


/link (Pass Options to Linker)

Passes one or more linker options to the linker.

Syntax

/link linker-options

Arguments

linker-options
The linker option or options to be passed to the linker.

Remarks

The /link option and its linker options must appear after any file names and CL options. A space is required between /link and any linker options. For more information, see MSVC linker reference.

Example

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:

cl /W4 /EHsc hello.cpp there.obj /link /VERSION:3.14

To set this compiler option in the Visual Studio development environment

The IDE normally sends separate commands to compile and link your code. You can set linker options in your project property pages.

  1. Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.

  2. Select the Configuration Properties > Linker folder.

  3. Modify one or more properties. Choose OK to save your changes.

To set this compiler option programmatically

  • This compiler option can't be changed programmatically.

See also

MSVC Compiler Options
MSVC Compiler Command-Line Syntax