views:

39

answers:

2

I'm currently going through a process of refactoring includes to reduce compile time, and I've come across the following compile error:

[C++ Error] some_class.cpp(53): E2015 Ambiguity between 'IID_IDropTarget' and 'Virtualtrees::IID_IDropTarget'

The line of code it points to is:

 if (iid == IID_IUnknown || iid == IID_IDropTarget)

If I use Virtualtrees::IID_IDropTarget it compiles fine, however I need to use COMs IDropTarget interface which I have implemented. I believe the problem might be that the Virtualtrees component has another implementation of the IDropTarget interface and they are conflicting.

Any ideas how I can specify that I don't want Virtualtrees::IID_IDropTarget? Or the namespace I use for COM's IID_IDropTarget?

+1  A: 

Prepend the name with "::" - specify it as ::IID_IDropTarget - this will effectively tell C++ that you want the one from global namespace.

sharptooth
+1  A: 

COM's IID_DropTarget is declared like so:

EXTERN_C const IID IID_IDropTarget;

Since it's extern "C", it's in the root namespace:

::IID_IDropTarget
Michael Burr