Compiling a VC++ 6.0 project with VC++ 7.1 problem: Error C2664 with CComPtr. Please help.
-
Hello dear ATL experts, While trying to compile a VC++ 6.0 project with VC++ 7.1, I have got the following error : d:\TESTINGONLY\dbstudio\DSIFormat.h(58) : error C2664: '_com_ptr_t<_IIID>::_com_ptr_t(int)' : cannot convert parameter 1 from 'ATL::CComPtr<T>' to 'int' with [ _IIID=_com_IIID<StdFormat::IStdDataFormatDisp,& _GUID_6c51b910_900b_11d0_9484_00a0c91110ed> ] and [ T=StdFormat::IStdDataFormatDisp ] No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called This error is caused by the following instanciation CComPtrStdFormat::IStdDataFormatDisp m_fmtBinary; StdFormat::IStdDataFormatDisp is located in a .tlh file. I am a newbee with COM and I guess it is an interface generated by the compiler. Here is its definition struct __declspec(uuid("6c51b910-900b-11d0-9484-00a0c91110ed")) IStdDataFormatDisp : IDataFormatDisp { // // Property data // __declspec(property(get=GetType,put=PutType)) enum FormatType Type; __declspec(property(get=GetFormat,put=PutFormat)) _bstr_t Format; } It derives from struct __declspec(uuid("e675f3f0-91b5-11d0-9484-00a0c91110ed")) IDataFormatDisp : IDispatch {}; IDataFormatDisp does nothing so I wonder why not deriving IStdDataFormatDisp direcly from IDispatch Indeed the project works fine with visual c++ 6.0. I thank you very much for your help.