Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / October 2005

Tip: Looking for answers? Try searching our database.

#include file conflict

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Olav - 26 Oct 2005 11:28 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
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.