CL /Zg


This option has no arguments. It is /Zg only.


The /Zg option weakly overrides /Gm. It passes unchanged to the front-end C and C++ compilers (C1 and C1XX).

Behaviour (CL)

The /Zg option leaves only the front-end C and C++ compilers as active. It disables all the remaining build stages: namely, Processing, Generating Code and Linking (though Processing can later be enabled by following with /B1_5).

CL understands the primary outcome from the compiler modules is to write text to standard output. CL protects this outcome by disabling a mechanism that might otherwise cause the compiler modules to write other text to standard output.

Specifically, the /Zg option stops CL from duplicating standard output as standard error. Both CL (after its command-line analysis) and the compiler modules write most text, particularly error and warning messages and related notes, to standard error. By duplicating standard output as standard error before executing compiler modules, CL arranges that these messages, though still written to standard error, end up with whatever file or device CL was given as standard output. The ordinarily desirable effect is that these messages become subject to command-line redirection for easy capture to a file. Use of /Zg implies that this effect is not wanted. Whatever text the compiler modules are expected to produce because of /Zg goes to standard output (and is subject to command-line redirection), but error messages, etc, go to the file or device that was given to CL as standard error (and are not subject to command-line redirection).

Behaviour (Compiler Modules)