DOC: MIDL /char Switch Does Not Behave as Expected
Article ID: 193471
Article Last Modified on 7/11/2005
APPLIES TO
- Microsoft Platform Software Development Kit-January 2000 Edition
- Microsoft Visual C++ 5.0 Enterprise Edition
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft Visual C++ 5.0 Professional Edition
- Microsoft Visual C++ 6.0 Professional Edition
- Microsoft Visual C++ 6.0 Standard Edition
This article was previously published under Q193471
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:
201094 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
Keywords: kbbug kbdocfix kbdocerr kbdsstools KB193471