Page 1 of 1

Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WCHAR'

PostPosted: Fri Apr 17, 2015 9:32 pm
by Azazaz
Hi again.

I'm getting an ambiguity error in XE7 and am wondering how to fix?

[bcc32 Error] oledlg.h(806): Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WCHAR'

I'm very new to using Firedac. In fact, I am in the midst of trying to convert this project to use Firedac.

I couldn't find anything on the subject via Google, etc. I don't much want to edit oledlg.h, and I am not explicitly including it in the project, and have not been able to find the include except in oledlb.pas, but the error is showing up anyway when I try to build the project.

Maybe this is WIn api related?

Re: Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WC

PostPosted: Fri Apr 17, 2015 11:08 pm
by Azazaz
I edited the file temporarily (I hope) just to get on with things, and ...

Now the same error is also showing up here:

[bcc32 Error] GdiplusImaging.h(112): Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WCHAR'
[bcc32 Error] GdiplusHeaders.h(186): Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WCHAR'
[bcc32 Error] GdiplusFlat.h(149): Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WCHAR'

Re: Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WC

PostPosted: Sun Apr 19, 2015 11:41 am
by rlebeau
The Win32 API has a WCHAR typedef for the wchar_t data type. FireDAC is clearly defining its own WCHAR as well. That alone is likely a bug, IMHO (I don't use FireDAC, so I don't know how it is using WCHAR), and should be reported to QualityPortal.

But more importantly, Delphi-generated HPP files dump everything they declare into the global namespace by default - the same namespace that Win32 uses. Hence the ambiguity. But fortunately those dumps are wrapped in ifdef's to disable the dumping. Open Firedac.Phys.Adscli.hpp and locate the NO_USING_NAMESPACE... condition(s) and add them to your project settings to disable dumping for just that unit, or you can add DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE to disable all dumping in all Delphi-generated headers.

Re: Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WC

PostPosted: Sun Apr 19, 2015 9:02 pm
by Azazaz
Thanks.

I've never done this before so am currently researching how to do it, i.e., trying to understand what you are talking about. LOL.

Re: Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WC

PostPosted: Mon Apr 20, 2015 12:19 pm
by rlebeau
Azazaz wrote:Thanks.

I've never done this before so am currently researching how to do it, i.e., trying to understand what you are talking about. LOL.


Go to Project > Options > C++Compiler > Directories and Conditionals.

In the Conditional defines list, you can enter in the relevant NO_USING_NAMESPACE... defines from Firedac.Phys.Adscli.hpp, or the global DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE define.

Refer to EDN for more details:

C++ Compiler Directories and Conditionals

Re: Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WC

PostPosted: Tue Apr 21, 2015 1:24 pm
by Azazaz
I was thinking that (after having tried a couple of other approaches) and this confirms it.

Thanks again.

Re: Ambiguity between 'WCHAR' and 'Firedac::Phys::Adscli::WC

PostPosted: Tue Apr 28, 2015 1:35 pm
by Azazaz
Adding the defines mentioned fixed things.

Thanks!