DOC: MIDL /char Switch Does Not Behave as Expected

ID: Q193471


The information in this article applies to:


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


REFERENCES

For Visual C++ 5.0 and 6.0 see the following online documentation:

MSDN Library : SDK Documentation; Platform SDK; COM and ActiveX Object Services; MIDL; MIDL Command-Line Reference

Additional query words:


Keywords          : kbdocfix kbdocerr kbSDKPlatform kbVC500bug kbVC600bug 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: July 15, 1999