To verify the correct operation of /cpp_opt options, invoke the C preprocessor independently before including the command line as part of the MIDL compiler command line. When called independently, the C compiler correctly reports errors caused by invalid options.
Incorrect usage of the MIDL command-line /cpp_opt switch can produce error messages related to the IDL file. These errors are incorrectly reported by the MIDL compiler when operating with some C compilers.
For example, invalid command-line syntax to the Microsoft C compiler can be reported as a syntax error in the IDL file when that syntax is included as part of the MIDL compiler command line. The error is not in the IDL file, but in the MIDL compiler /cpp_opt input.
The following MIDL compiler command line contains the /cpp_opt switch and related options:
midl /cpp_cmd "cl" /cpp_opt /E foo.idl
The options in this command line can be verified by invoking the compiler only, as shown:
cl /E foo.idl