VS 2003 upgrades results in C2872: 'CONNECTDATA' ambiguous symbol

L

Lee Gillie

I have a VS6 project which I brought into VS .NET, and all has been
building fine. Then I upgraded to VS 2003 and I have one source which
will no longer compile. Any clues?

Compiling...
DotNetManagedExport.cpp
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\atlcom.h(5529) : error C2872: 'CONNECTDATA' :
ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\OCIdl.h(395) : tagCONNECTDATA
CONNECTDATA'
or 'C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\vcclr.h(15) :
System::Runtime::InteropServices::CONNECTDATA'
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xmemory(136) : while compiling class-template member
function 'HRESULT
ATL::IConnectionPointImpl<T,piid,CDV>::EnumConnections(IEnumConnection
s ** )'
with
[
T=CKeyBuild,
piid=& _GUID_d74f30ea_21d1_4857_b8d2_75ba604fc8a1,
CDV=ATL::CComDynamicUnkArray
]
d:\ODP\PPS\PPS System\PPSLibNET\_IKeyBuildEvents_CP.h(6) : see
reference to class template instantiation
'ATL::IConnectionPointImpl<T,piid,CDV>' being compiled
with
[
T=CKeyBuild,
piid=& _GUID_d74f30ea_21d1_4857_b8d2_75ba604fc8a1,
CDV=ATL::CComDynamicUnkArray
]
d:\ODP\PPS\PPS System\PPSLibNET\KeyBuild.h(17) : see reference to
class template instantiation 'CProxy_IKeyBuildEvents<T>' being
compiled
with
[
T=CKeyBuild
]
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\atlcom.h(5530) : error C2872: 'CONNECTDATA' :
ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\OCIdl.h(395) : tagCONNECTDATA
CONNECTDATA'
or 'C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\vcclr.h(15) :
System::Runtime::InteropServices::CONNECTDATA'
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\atlcom.h(5537) : error C2872: 'CONNECTDATA' :
ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\OCIdl.h(395) : tagCONNECTDATA
CONNECTDATA'
or 'C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\vcclr.h(15) :
System::Runtime::InteropServices::CONNECTDATA'
 
A

Arjun Bijanki [VCPP MSFT]

--------------------
From: "Lee Gillie" <[email protected]>
Subject: VS 2003 upgrades results in C2872: 'CONNECTDATA' ambiguous symbol
Date: Wed, 6 Aug 2003 07:55:26 -0700
Lines: 62
I have a VS6 project which I brought into VS .NET, and all has been
building fine. Then I upgraded to VS 2003 and I have one source which
will no longer compile. Any clues?

Try moving your "using namespace System;" directive down after the
#includes. Does that solve the problem?
 
L

Lee Gillie

Ajun -

Thanks for replying. I tried what you suggested, but it made no
difference. I tried also moving the #using <xxx.dll> statements.

- Lee
 
T

Tanveer Gani [MSFT]

--------------------
From: "Lee Gillie" <[email protected]>
References: <[email protected]>
Subject: Re: VS 2003 upgrades results in C2872: 'CONNECTDATA' ambiguous symbol
Date: Tue, 12 Aug 2003 09:13:32 -0700
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.vc
NNTP-Posting-Host: user.odp.com 204.130.175.250
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:27149
X-Tomcat-NG: microsoft.public.dotnet.languages.vc

Ajun -

Thanks for replying. I tried what you suggested, but it made no
difference. I tried also moving the #using <xxx.dll> statements.

- Lee

Lee,

The ambiguous symbol error simply says that the compiler has seen a symbol
called "CONNECTDATA" and it can't determine whether it's the one from the
namespace System::Runtime::InteropServices or the one from the global
namespace. Presumably you have a using namespace
System::Runtime::InteropServices directive somewhere in your code. Try
doing one of these:

1. Localize the directive. Instead of putting it in the global namespace
move it to a local scope where you need it.

2. Use a *using declaration* instead of a using directive:

using System::Runtime::InteropServices::CONNECTDATA;

If there's any ambiguity at this point, you'll get an immediate error.

3. Remove the using directive and use the fully qualified name.

Option (3) should solve your problem if (1) and (2) don't work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top