views:

650

answers:

2

G'day everyone

I'm a newbie to C++ and even more so to Borland Turbo C++ Explorer. I've just encountered this compile error. Any clues as to how to fix it?

[C++ Error] comsvcs.h(3209): E2015 Ambiguity between 'ITransaction' and 'Oledb::ITransaction'
[C++ Error] comsvcs.h(3275): E2015 Ambiguity between 'ITransaction' and 'Oledb::ITransaction'
[C++ Error] comsvcs.h(16197): E2015 Ambiguity between 'ITransaction' and 'Oledb::ITransaction'
[C++ Error] comsvcs.h(16293): E2015 Ambiguity between 'ITransaction' and 'Oledb::ITransaction'

The code where the first one occurs is

EXTERN_C const IID IID_ICreateWithTransactionEx;

#if defined(__cplusplus) && !defined(CINTERFACE)

    MIDL_INTERFACE("455ACF57-5345-11d2-99CF-00C04F797BC9")
    ICreateWithTransactionEx : public IUnknown
    {
    public:
 virtual /* [helpstring][helpcontext] */ HRESULT STDMETHODCALLTYPE CreateInstance(
     /* [in] */ ITransaction *pTransaction,
     /* [in] */ REFCLSID rclsid,
     /* [in] */ REFIID riid,
     /* [iid_is][retval][out] */ void **pObject) = 0;

    };

A couple of suggestions from another source:

As the error message of the compiler tells there are 2 declarations of the ITransaction datatype in scope of the compilation unit. It seems the the ITransaction definition comes from Microsoft's comsvcs.h and that the OleDB::ITransaction is a implementation of the ITransaction interface from Borland. So you could try 2 things:

  1. eliminate the OleDB::ITransaction definition (don't know Turbo C++, but there may be a component dealing with oleDB. Try to get rid of this. Or it may be included by using another #include. Search for the text oledb::ITransaction in your include directory and you will hopefully find the relevant file. Modify the include path so it is not included any more).
  2. you could try to define CINTERFACE because the code resulting in the compile error will not be included if this is defined. But that may cause other problems...

Does anyone have any other suggestions?

Kind regards, Bruce.

A: 

I have no clue how to do COM or what your ITransaction is, but it seems to me like your scope contains two ITransaction types. Can you be more explicit in your function prototype? Can you scope the ITransaction you want to use? Say "::ITransaction" (to use global namespace) or "some_other_namespace::ITransaction"?

Filip
Good idea. Shall try that!
boost
A: 

Okay, we need to close this question somehow. After updating Turbo C++ Explorer with the latest patches the problem went away.

Thanks to all who offered suggestions along the way.

boost