Hi,
we have an MFC app where the database interface is ADO.NET. The rest of the
app is unmanaged. We want to interface to another app by using OLE. We have
done this before with other vendors and it works fine. But with the #import
directive with the .tlb from this vendor VS reports the following compiler
error:
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\comdefsp.h(1036) : error C2872: 'IServiceProvider' :
ambiguous symbol
could be 'c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\ServProv.h(100) : IServiceProvider'
or 'c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\vcclr.h(15) : System::IServiceProvider'
There is no using namespace in top of the import directive. The .cpp file
looks like this from the top:
#define STRICT
#include "stdafx.h"
#include "MyProg.h"
#include <ServProv.h>
#import "PGRIntf.tlb" named_guids no_namespace
Olav
Robert Jordan - 26 Oct 2005 12:04 GMT
Hi,
> we have an MFC app where the database interface is ADO.NET. The rest of the
> app is unmanaged. We want to interface to another app by using OLE. We have
[quoted text clipped - 19 lines]
> #include <ServProv.h>
> #import "PGRIntf.tlb" named_guids no_namespace
Well, you're using "no_namespace". Remove it or use
rename_namespace("your_favorite_namespace").
Rob
Olav - 26 Oct 2005 14:01 GMT
Hi Robert,
I tried both, removing no_namespace and renaming it but the error message
remains the same.
Olav
> Hi,
>
[quoted text clipped - 26 lines]
>
> Rob
Willy Denoyette [MVP] - 30 Oct 2005 12:17 GMT
Please post MFC and C++ related issues to the appropriate NG -
microsoft.public.dotnet.languages.vc, you might get better answers there.
Willy.
> Hi,
> we have an MFC app where the database interface is ADO.NET. The rest of
[quoted text clipped - 25 lines]
>
> Olav
Olav - 30 Oct 2005 12:59 GMT
If I place the #import line before the first "using namespace System" the
error message disappears. But i dont like to do it because that have to be in
stdafx.h and i want it to be in a separate file where the rest of the
integration is.
> Please post MFC and C++ related issues to the appropriate NG -
> microsoft.public.dotnet.languages.vc, you might get better answers there.
[quoted text clipped - 30 lines]
> >
> > Olav