Sign in to follow this  

C++/CLI with DX9 [Solved]

This topic is 3811 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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, [edit] 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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

This topic is 3811 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this