BUG: You receive an "Unable to create the function" error message when you try to add a method as the variable type in the ATL Interface Wizard with Visual C++ (198017)
The information in this article applies to:
- The Microsoft Active Template Library (ATL) 3.0, when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 6.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 Q198017 SYMPTOMSIn the ATL Interface Wizard with Visual C++ 6.0, you receive the following error message: "Unable to create the function
because the header or the implementation file could not be found."
This problem occurs when you add a method that has either SAFEARRAY(oleautomationtype)"
or "SAFEARRAY(oleautomationtype)*" as the variable type. oleautomationtype is
an OLE automation-compatible data type. CAUSE This is due to a bug in the ATL Interface Wizard.
WORKAROUND Add these methods by manually editing the .idl, .h, and
.cpp files. The following shows the changes when adding two methods
(called Test and Test2 that have SAFEARRAY(BSTR)* and SAFEARRAY(BSTR),
respectively) to an interface called IATLObj. IATLObj is implemented by an ATL
class called CATLObj. - Add this code for the new methods in the .IDL file:
interface IATLObj : IDispatch
{
[id(1)] HRESULT Test([out] SAFEARRAY(BSTR) *ppArrayBstr);
[id(2)] HRESULT Test2([in] SAFEARRAY(BSTR) pArrayBstr);
};
- Add this code to the .H file for the ATL COM object:
STDMETHOD(Test)(SAFEARRAY **ppArrayBstr);
STDMETHOD(Test2)(SAFEARRAY *pArrayBstr);
- And add this code to the .CPP file for the ATL COM object:
STDMETHODIMP CATLObj::Test(SAFEARRAY **ppArrayBstr)
{
return S_OK;
}
STDMETHODIMP CATLObj::Test2(SAFEARRAY *pArrayBstr)
{
return S_OK;
}
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.REFERENCES
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
196837
BUG: Compile errors result for certain ATL method parameters
Modification Type: | Major | Last Reviewed: | 6/1/2005 |
---|
Keywords: | kbtshoot kberrmsg kbAutomation kbBug kbCollectionClass kbpending kbwizard KB198017 kbAudDeveloper |
---|
|