Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 2.42 KB

zl-omit-default-library-name.md

File metadata and controls

60 lines (40 loc) · 2.42 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: /Zl (Omit Default Library Name)
/Zl (Omit Default Library Name)
11/04/2016
/zl
VC.Project.VCCLCompilerTool.OmitDefaultLibName
-Zl compiler option [C++]
ZI compiler option
Omit Default Library Name compiler option
/Zl compiler option [C++]
default libraries, omitting names
b27d39d0-44d6-498c-84ae-27c1326fee59

/Zl (Omit Default Library Name)

Omits the default C runtime library name from the .obj file. By default, the compiler puts the name of the library into the .obj file to direct the linker to the correct library.

Syntax

/Zl

Remarks

For more information on the default library, see Use Run-Time Library.

You can use /Zl to compile .obj files you plan to put into a library. Although omitting the library name saves only a small amount of space for a single .obj file, the total space saved is significant in a library that contains many object modules.

This option is an advanced option. Setting this option removes certain C Runtime library support that may be required by your application, resulting in link-time errors if your application depends on this support. If you use this option you must provide the required components in some other way.

Use /NODEFAULTLIB (Ignore Libraries). to direct the linker to ignore library references in all .obj files.

For more information, see CRT Library Features.

When compiling with /Zl, _VC_NODEFAULTLIB is defined. For example:

// vc_nodefaultlib.cpp
// compile with: /Zl
void Test() {
   #ifdef _VC_NODEFAULTLIB
      int i;
   #endif

   int i;   // C2086
}

To set this compiler option in the Visual Studio development environment

  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 > C/C++ > Advanced property page.

  3. Modify the Omit Default Library Names property.

To set this compiler option programmatically

  • See xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.OmitDefaultLibName%2A.

See also

MSVC Compiler Options
MSVC Compiler Command-Line Syntax