我在我的一个ATL的COM中使用了MFC的Socket,结果在编译的时候报错:
C2668: InlineIsEqualGUID:Ambiguous Call to Overloaded Function
后来查了一下,才发现问题在此......
FIX: Error Message: C2668: InlineIsEqualGUID : Ambiguous Call to Overloaded Function Q243298
The information in this article applies to: • The Microsoft Active Template Library (ATL) 3.0, used with: o Microsoft Visual C++, 32-bit Editions, version 6.0
SYMPTOMS Building a default ATL project containing a COM object supporting ISupportErrorInfo might result in the following error: C2668: ''InlineIsEqualGUID'' : ambiguous call to overloaded function This error may also occur when calling the function InlineIsEqualGUID() in your ATL project.
CAUSE The problem occurs because the function InlineIsEqualGUID() is defined both in the ATL header file, AtlBase.h, and the Platform SDK header file, Guiddef.h, in different name spaces. The include paths for the build point first to the Platform SDK include directory, and then to the ATL include directory. In the ATL header, InlineIsEqualGUID() is defined in a name space called "ATL", while in the Platform SDK header it is defined in the global name space. Because AtlBase.h includes the statement
using namespace ATL; the compiler is unable to distinguish which definition to use.
RESOLUTION There are three ways to work around this problem: • Prefix the call to the InlineIsEqualGUID() function with either :: or ATL::. This explicitly indicates whether you want to use the ATL or Platform SDK definition. For example: • • ::InlineIsEqualGUID() ATL::InlineIsEqualGUID()
• Change the order of the include directories on the Directory tab of the Options dialog box, which is accessed from the Tools menu, so that the ATL include directory is before the Platform SDK include directory. • In the StdAfx.h file of your ATL project, change the path of AtlBase.h to point to the AtlBase.h file in the ATL30 directory under the Platform SDK include directory.
STATUS Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
This problem was corrected in the Microsoft Platform SDK January 2000 Edition.
MORE INFORMATION Steps to Reproduce Behavior 1. Create an ATL DLL project and insert a simple object into the project with ISupportErrorInfo support. 2. Make sure that the includes path for the Platform SDK include directory comes before the ATL include directory on the Directory tab of the Options dialog box, which is accessed from the Tools menu. 3. Build the project, and the error message appears. Additional query words: PlatSDK MMC Samples ATL Object Wizard Keywords : kbCOMt kbDebug kbSDKPlatform kbSDKWin32 kbVC600bug kbATL300bug kbDSupport kbfix kbGrpMFCATL Issue type : kbbug Technology : kbvc
(落鹤生) |