DOC: MIDL /char Switch Does Not Behave as Expected (193471)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0
  • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
  • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
  • Microsoft Visual C++, 32-bit Professional Edition 5.0
  • Microsoft Visual C++, 32-bit Professional Edition 6.0
  • Microsoft Visual C++, 32-bit Learning Edition 6.0

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


Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbBug kbdocerr kbdocfix kbDSSTools KB193471