You receive the "C4199" compiler error together with the "ATL4058" warning when you build attributed ATL code in Visual C++ .NET (315002)
The information in this article applies to:
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
This article was previously published under Q315002 SYMPTOMS C4199 is an undocumented compiler warning. However, you may
receive this warning in conjunction with an ATL4058 warning when you build
attributed Active Template Library (ATL) code. For example, you could get the
following message when you build the project: warning
C4199: coclass Atl Attribute Provider : warning ATL4058: "ISomeInterface"
is not an interface defined in embedded IDL. It will not be replaced with the
corresponding IDispatchImpl. NOTE: Visual C++ .NET supports both the managed code model that is
provided by the .NET Framework and the unmanaged native Windows code model. The
information in this article applies only to unmanaged Visual C++ code.
CAUSE This error occurs because you did not define ISomeInterface
in embedded interface definitions in your code. RESOLUTION When an interface that derives from IDispatch is not in
embedded Interface Definition Language (IDL) code (or is derived from an
interface that is not in embedded IDL code), the attribute provider cannot
replace the interface with the corresponding IDispatchImpl, which should be of
the form.
IDispatchImpl<ISomeInterface, &__uuidof(ISomeInterface), [LIBID of the type
library that has type information for the interface],
[Major version of the type library], [Minor version of the type library]>
The ATL attribute provider cannot determine the type information from
the header file that defines the interface. The resolution that you
select depends on what you want to accomplish:
- If your interface is a dispinterface or a dual interface
and you are implementing the IDispatch methods, you can ignore the error
message.
- If your interface is a dispinterface or dual interface and
you expect the attribute provider to implement the IDispatch methods (either
through the use of an IDispatchImpl or the compiler to generate the IDispatch
methods), the warning is letting you know that the attribute provider cannot
implement the IDispatch methods for you. To fix this, derive your class from
IDIspatchImpl instead of the interface.
STATUSThis
behavior is by design.REFERENCES For more information, visit the following Microsoft
Developer Network (MSDN) Web sites:
Modification Type: | Major | Last Reviewed: | 6/27/2006 |
---|
Keywords: | kbCompiler kbprb kbProd2Web KB315002 kbAudDeveloper |
---|
|