/Yl (Inject PCH Reference for Debug Library)

Used if creating a debugging library that uses precompiled headers and the build fails.

/Ylsymbol

/Yl-

Arguments

  • symbol
    An arbitrary symbol to be stored in the object module.

  • -
    A minus sign (-) that explicitly disables the /Yl compiler option.

Remarks

By default, the compiler uses the /Yl option (without specifying a symbol). The /Yl option enables the debugger to get complete information about types. /Yl- disables the default behavior.

When you compile a module with /Yc and /Ylsymbol, the compiler creates a symbol similar to __@@_PchSym_@00@...@symbol, where the ellipsis (...) represents a linker-generated character string, and stores it in the object module. Any source file that you compile with this precompiled header refers to the specified symbol, which causes the linker to include the object module and its debugging information from the library.

Using this option, you may generate LNK1211. When you specify the /Yc (Create Precompiled Header File) and /Z7, /Zi, /ZI (Debug Information Format) options, the compiler creates a precompiled header file that contains debugging information. An error can occur when you store the precompiled header in a library, use the library to build an object module, and the source code does not refer to any of the functions the precompiled header file defines.

To solve the problem, specify /Ylsymbol, where symbol is the name of an arbitrary symbol in the library, when you create a precompiled header file that does not contain any function definitions. This option directs the compiler to store the debugging information in the precompiled header file.

For more information on precompiled headers, see:

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.

  2. Click the C/C++ folder.

  3. Click the Command Line property page.

  4. Type the compiler option in the Additional Options box.

To set this compiler option programmatically

See Also

Reference

Compiler Options

Setting Compiler Options