'/option' not allowed with multiple source files
This error 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.
This error occurs when CL is given at least two compilable input files and one of the following options:
The message text shows the offending /option with its argument.
cl /c /Fatest.asm test1.cpp test2.cpp
is typical. The /Fa option directs that an assembly-language listing file be created as a by-product of compiling each C or C++ source file. Since the two input files to the command are both compilable, there are two listing files to produce. However, the /Fa option is given with the syntax that names only one listing file, hence error D2036.
Ordinarily, the compilable input files are C and C++ source files, in the sense of CL recognising them as having a front-end or back-end C or C++ compiler among the applicable compiler modules. What counts as a compilable input file for this error is not necessarily the same. The difference may mean on the one hand that the error occurs when not actually needed, and on the other that the error does not occur even though it ought.
For the purpose of this error, as actually coded, an input file counts as compilable if it is either
Note that an input file counts for error D2036 if it is named in its own command-line token, with the file extension of a C or C++ source file, even if a /TO option causes CL to treat the file as an object file.
Conversely, an input file that is named in its own command-line token, does not have the file extension of a C or C++ source file, but gets compiled as a C or C++ source file because of a /TC or /TP option, does not count for error D2036. More exotically, neither does an input file count for this error if it is named in its own command-line token with an unrecognised file extension but is compiled (well, preprocessed) as a C source file because of a /E or /EP option.
In the admittedly contrived command
cl /Fatest.asm /TO /Tptest1.c test2.cpp
the first input file has the extension of a C source file but is to be compiled as a C++ source file, because it is named through /Tp, and the second input file has the extension of a C++ source file but is to be treated as an object file, because of the /TO. The command therefore has only one input file to compile, but terminates with error D2036 because CL counts both the input files as C++ source files without allowing that this identification will change because of the /TO.
For an example of the converse, consider the following command
cl /Fatest.asm /TP test1.c test2.h
Because of the /TP, the command has two C++ source files to compile. The command therefore has two assembly-language listing files to create in response to the /Fa, but only one name for them. Yet error D2036 is avoided, because although the first input file counts as compilable for causing the error, the second does not.
Where the product documentation lists the applicable options, it omits the options that the product documentation anyway doesn’t document, i.e., /Fc, /Fl and /ZX.