Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error C2872: 'IDataObject' : ambiguous symbol

Status
Not open for further replies.

UtmostCathode

Programmer
Mar 9, 2005
6
US
I've been having some trouble with this error for a few hours now. It's a hard question to ask, because there's nothing specific about it. The error itself is ambiguous.

All I know is that it has to do with the order I include windows.h or dinput.h, or how many times. To expand: I need to create a DirectInput object to play around with a USB mouse, thus I need to include dinput.h, however, when I do this it spits out the error. It also gives the error if I do *not* include dinput, but include windows.h a second time somewhere in my project.

I'm working in Microsoft Visual C++ .NET, Visual Studio .net professional 2003. I've basically just been working with Forms, and now I want to create a user joystick interface.
 
Odd...could you post the code that is causing the error? You aren't trying to create an object of an interface are you? Probably not, I wouldn't think you'd get this error if you were. Do a lookup of where IDataObject is defined perhaps and you will get more of a clue. Perhaps there is more than one definition of IDataObject but defined in different namespaces?
 
Oh yeah in my angry haste I neglected to include the actual error:

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7408): error C2872: 'IDataObject' : ambiguous symbol

And,

------ Build started: Project: Test06, Configuration: Debug Win32 ------

Compiling...

Color.cpp

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : warning C4935: assembly access specifier modified from 'public'

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(258) : warning C4935: assembly access specifier modified from 'public'

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7408) : error C2872: 'IDataObject' : ambiguous symbol

could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : System::Windows::Forms::IDataObject IDataObject'

or 'Color.cpp(0) : System::Windows::Forms::IDataObject'

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7422) : fatal error C1903: unable to recover from previous error(s); stopping compilation



Build log was saved at "file://c:\Documents and Settings\jhenders\My Documents\Visual Studio Projects\currentTest\Debug\BuildLog.htm"

Test06 - 2 error(s), 2 warning(s)



And I'm not messing around with an interface at all - that I know of anyways. I'm new to Windows programming, so my code is embarassingly inefficient, since my goal was just trying to get it to function.
 
Update. It seems like commenting out using namespace System, and System::Windows::Forms - and hardcoding those in where necessary for their members - fixed the problem. Oh well, hope this can help someone else in the future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top