supamike

Hi, i've recently been working with an app with VSC++ and DirectX9.

The entry point creates the main GUI object (managed) and also a DirectX object (unmanaged), and then runs it like normal.

Recently the need has arisen for me to move the DX object to be a member of the GUI class.

I changed the GUI class to include my DX header, which includes the standard <d3d9.h> <d3dx9.h> <dxerr.h>, and wrote the relavant code. However apon compilation I get many ambiguation errors, which are basically a repitition of this:

1>C:\Program Files\Microsoft Platform SDK\Include\objidl.h(7408) : error C2872: 'IDataObject' : ambiguous symbol

1> could be 'C:\Program Files\Microsoft Platform SDK\Include\objidl.h(246) : System::Windows::Forms::IDataObject IDataObject'

So it seems there's multiple definitions in System::Windows::Forms, which is of course a namespace in my GUI, and the platform SDK, which i assume DX is referring to.

Is this a conflict between managed and unmanaged code do i need to consider using managed DirectX I can't seem to think of any way around this except to move the DX object back into my entry code, where DX can reside safely as it doesn't use the Forms namespace, however this will cause me problems later on.

Thanks,

Mike



Re: Visual C++ Express Edition using C++/CLI with DX9 unmanaged

nobugz

It is a problem with your "using namespace System:: Windows:: Forms" directive. It brings the IDataObject interface declaration in scope. You could remove the "using namespace" directive but that could be painful. Or you could write ":: IDataObject" to tell the compiler you want the global definition.





Re: Visual C++ Express Edition using C++/CLI with DX9 unmanaged

supamike

Thanks for the reply. Yes it would be very painful to remove the Forms namespace, and not really an option since the form designer relies on it heavily.

The problem with using ::IDataObject is i'm not actually creating anything explicitly using IDataObject. All the errors are coming from within the header files which i include, and i don't want to go changing them e.g. objidl.h in the platform sdk.





Re: Visual C++ Express Edition using C++/CLI with DX9 unmanaged

nobugz

Okay, got ya. Make sure the #include directive for any unmanaged header files appear before the #include for the form header file. stdafx.h is a good place.





Re: Visual C++ Express Edition using C++/CLI with DX9 unmanaged

supamike

Moving the include directive for my unmanaged class before including the managed classes worked, and it compiles perfectly now.

Legend. Thats all it was, your the man.

Regards,

Mike