# C++/CLI with DX9 [Solved]

## Recommended Posts

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:
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'
1>        or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::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,  Changed my post to try and make more sense, i was half asleep when i wrote it. [Edited by - supamike on July 9, 2007 8:43:30 AM]

##### Share on other sites
Solved. When including header files unmanaged classes need to be included before managed classes, so they don't get caught in a managed namespace e.g. system.windows.forms. this is what happened and thus why the ambiguity occured.

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627654
• Total Posts
2978447

• 10
• 12
• 22
• 13
• 33