CL Command-Line Warning D4027

Message Text

source file 'filename' ignored

This warning message is written to whatever file or device was given to CL as standard error. It is therefore not subject to simple redirection from the Command Prompt, e.g., for capture to a file.


CL has understood filename as the name of an input file. Different types of input file have different selections of compiler modules (possibly including the linker) that are to handle the file. Warning D4027 means that all the applicable compiler modules for filename are disabled for the current build and CL therefore has nothing it can do with the file.

The following are the compiler options that affect which compiler modules are enabled: /B1_5, /BK, /c, /E, /EP, /P, /Zg, /Zs and /ZX.

An input file’s type is ordinarily decided from its file extension, but is subject to the following options: /E, /EP, /TC, /Tc, /TO, /To, /TP and /Tp.


Broadly speaking, this warning may occur in two ways. In one, which seems more likely in careful practice, the cited filename is (or was) intended as an input file, but the options are (now) inappropriate.

For example, while a project is very simple, a programmer may have CL direct the build all the way to linking, with some command such as

cl [options] test.cpp advapi32.lib

where already a library has been added as an input file because the source code uses a function that is not referenced in any default library. As the build grows in sophistication, e.g., as more source files are added, the programmer may think to add /c to the CL options and run the linker separately. If the programmer leaves the library on the CL command line, then warning D4027 reminds that the library is no longer any use there (and may prod the programmer to realise that it ought now be on the LINK command line).

Alternatively, it may be that warning D4027 is just a side-effect of some other problem that causes CL to identify filename as an input file against the user’s intentions. For an example, refer to the product documentation.

Documentation Status

The product documentation describes this warning as an error.