<nicolas.hilaire...motorola.com> wrote
> when using unmanaged class with my managed app, I've seen errors when
> including (for example) <windows.h>.
> One of theses erros is :
> IDataObject : ambiguous symbol error
> I've seen somewhere that to avoid this error, i've to remove all "using
> namespace XXXXX" from .h, and move it to .cpp.
> This is working ... but, i would like to know why such an error ?
Several distinct entities (probably types) named IDataObject
from different scopes have been introduced into the current
scope.
Windows Shell declares an IDataObject as a native
interface (=struct), the base class library has several
definitions of IDataObject as a managed interface.
All these types are different. When you say
using namespace System::Windows::Forms
IDataObject could refer to
the IDataObject in the global scope (from objidl.h) or to
System::Windows::Forms::IDataObject.
You can use qualified names to refer to the entity.
For instance,
::IDataObject // the one in the global scope
System::Windows::Forms::IDataObject // the other one
Windows::Forms::DataObject // same as above, assumes
// using namespace System
-hg
holgergrund
| Wed, 02 Jan 2008 19:18:00 GMT |