Microsoft KB Archive/193471

{|
 * width="100%"|

DOC: MIDL /char Switch Does Not Behave as Expected

 * }

Q193471

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK)
 * Microsoft Visual C++, 32-bit Enterprise Edition, versions 5.0, 6.0
 * Microsoft Visual C++, 32-bit Professional Edition, versions 5.0, 6.0
 * Microsoft Visual C++, 32-bit Learning Edition, version 6.0

-

SUMMARY
The MIDL /char command line switch is used to ensure that the MIDL compiler and the Visual C++ compiler operate together correctly for all char types. By default, a MIDL char is unsigned whereas a default char in Visual C++ is signed. The MIDL /char switch is used to force MIDL to generate signed or unsigned chars and can be used to match the type generated by the Visual C++ compiler.

The online documentation at keyword index /char states the following:

"The /char signed option indicates that the C-compiler char type is signed." Using /char signed results in MIDL chars that are unsigned. Therefore, the types will be mismatched and the project will not compile. Use /char unsigned to generate MIDL signed chars.

The same documentation also states the following:

"The /char unsigned option indicates that the C-compiler char type is unsigned." Using /char unsigned results in MIDL chars that are signed. Therefore, the types will be mismatched and the project will not compile. Use /char signed to generate MIDL unsigned chars. For additional information, please see the following article in the Microsoft Knowledge Base:

"Q201094 PRB: Error C2259 on 'char' Type Redefinition in Visual C++ ATL Project"