BUG: "AtlReportError: no overloaded function takes X parameters"

ID: Q194861


The information in this article applies to:


SYMPTOMS

Porting an ATL 2.x project to ATL 3.0 might give you the following compilation error:

error C2661: 'AtlReportError' : no overloaded function takes 2 parameters.


CAUSE

AtlReportError() does not have any default parameters in ATL 3.0. AtlReportError() in ATL 2.1 did have default parameters.


RESOLUTION

Specify all the parameters required by AtlReportError() or complete the following steps:

  1. Use the CComCoClass static member Error() which accepts default arguments. For example, replace:
    
          return AtlReportError(
             CLSID_PolyCtl, _T("Must have between 3&100 sides")); 
    with:
    
          // If your class is derived from CComCoClass<CMyClass,
          // &CLSID_MyClass>:
          return Error(_T("Must must have between 3 & 100 sides"));
    
          // If not derived from CComCoClass<>:
          return CComCoClass<CMyClass, &CLSID_MyClass>::Error(
             _T("Must must have between 3 & 100 sides")); 


  2. Modify \vc98\atl\include\atlcom.h so that all the function prototypes for AtlReportError() accept default arguments. Essentially use the same prototypes used in ATL 2.1. The following code lists the various prototypes of AtlReportError and their default argument equivalents in the same order as AtlCom.h:




STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Jaganathan Thangavelu, Microsoft Corporation.

Additional query words:


Keywords          : kberrmsg kbVC600bug kbATL300bug 
Version           : WINDOWS:3.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: August 3, 1999