PRB: Error C2259 on "char" Type Redefinition in Visual C++ ATL ProjectID: Q201094
|
Compiling a Visual C++ ActiveX Template Library (ATL) Project may result in the Visual C++ compiler error C2259. This problem can occur when a parameter of type char is not qualified as signed char or unsigned char.
A workaround for this problem is to qualify "char" parameters as either "unsigned char" or "signed char."
There is a discrepancy between the way an unqualified "char" parameter is treated by the MIDL compiler and by the Add Method or Add Property dialog boxes.
The MIDL compiler generates a Visual C++ prototype for the interface where the parameter type is "unsigned char." MIDL's default type is unsigned unless qualified with the "signed" keyword. The C++ method generated by the Add Method to Interface or Add Property to Interface dialog boxes has a parameter type of "char"; in the Visual C++ compiler, "char" is signed by default. This causes a Visual C++ compiler error.
error C2259: 'CComObject<class ErrTestClass>' : cannot instantiate abstract class due to following members:
warning C4259: 'long __stdcall IErrTestClass::ErrTestMethod(unsigned char)' : pure virtual function was not defined
For more information, see the following article in the Microsoft Knowledge Base:
Q193471 DOC: MIDL /char Switch Does Not Behave as Expected
Additional query words: kbDSupport kbdss
Keywords : kbCompiler kbSDKPlatform kbVC500 kbVC500bug kbVC600 kbVC600bug kbGrpDSTools
Version : winnt:5.0,6.0
Platform : winnt
Issue type : kbprb
Last Reviewed: July 15, 1999