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

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

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

Postby Azazaz » Fri Apr 17, 2015 9:32 pm

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?
Azazaz
BCBJ Guru
BCBJ Guru
 
Posts: 105
Joined: Wed Sep 26, 2012 9:08 am

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

Postby Azazaz » Fri Apr 17, 2015 11:08 pm

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'
Azazaz
BCBJ Guru
BCBJ Guru
 
Posts: 105
Joined: Wed Sep 26, 2012 9:08 am

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

Postby rlebeau » Sun Apr 19, 2015 11:41 am

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.
Last edited by rlebeau on Mon Apr 20, 2015 12:24 pm, edited 1 time in total.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1533
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

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

Postby Azazaz » Sun Apr 19, 2015 9:02 pm

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.
Azazaz
BCBJ Guru
BCBJ Guru
 
Posts: 105
Joined: Wed Sep 26, 2012 9:08 am

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

Postby rlebeau » Mon Apr 20, 2015 12:19 pm

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
Last edited by rlebeau on Tue Apr 28, 2015 8:37 pm, edited 2 times in total.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1533
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

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

Postby Azazaz » Tue Apr 21, 2015 1:24 pm

I was thinking that (after having tried a couple of other approaches) and this confirms it.

Thanks again.
Azazaz
BCBJ Guru
BCBJ Guru
 
Posts: 105
Joined: Wed Sep 26, 2012 9:08 am

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

Postby Azazaz » Tue Apr 28, 2015 1:35 pm

Adding the defines mentioned fixed things.

Thanks!
Azazaz
BCBJ Guru
BCBJ Guru
 
Posts: 105
Joined: Wed Sep 26, 2012 9:08 am


Return to Technical

Who is online

Users browsing this forum: Bing [Bot] and 13 guests

cron