Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Ambiguity between 'PHKEY' and 'Windows::PHKEY'


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Apr 12, 2016 10:06 AM Last Post By: Asger Joergensen
Asger Joergensen

Posts: 370
Registered: 11/18/08
Ambiguity between 'PHKEY' and 'Windows::PHKEY'  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2016 2:33 PM
Hi

I'm using C++ Builder 2009

I'm trying to compile a project on my new PC and I'm getting this error:

[BCC32 Error] clusapi.h(3758): E2015 Ambiguity between 'PHKEY' and 'Windows::PHKEY'

The project compiled fine on my old PC

I don't think I use anything from clusapi.h in my project, but I do use something from resapi.h and that one include clusapi.h.
I have not made any changes to the project, so I don't know why I suddenly get the error now.

What can I do to fix this ??

Thanks in advance
Best regards
Asger
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Ambiguity between 'PHKEY' and 'Windows::PHKEY'  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2016 2:54 PM   in response to: Asger Joergensen in response to: Asger Joergensen
Asger wrote:

I'm trying to compile a project on my new PC and I'm getting this
error:

[BCC32 Error] clusapi.h(3758): E2015 Ambiguity between 'PHKEY' and
'Windows::PHKEY'

PHKEY is defined by the Windows SDK in the global namespace in windef.h,
and is also defined by the RTL in a custom namespace in Windows.hpp. clusapi.h
expects the definition from windef.h.

The problem is that Windows.hpp has a 'using namespace Windows' statement
that dumps its namespaced content into the global namespace by default.
Thus, if both headers are included in the same translation unit, you end
up with two definitions of PHKEY in global scope.

Try adding NO_USING_NAMESPACE_WINDOWS to your project's list of Conditionals
(or at least #define it above the #include that is pulling in Windows.hpp)
to disable the 'using' statement.

--
Remy Lebeau (TeamB)
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: Ambiguity between 'PHKEY' and 'Windows::PHKEY'  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 12, 2016 10:06 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:

Try adding NO_USING_NAMESPACE_WINDOWS to your project's list of Conditionals
(or at least #define it above the #include that is pulling in Windows.hpp)
to disable the 'using' statement.

Unfortunately that didn't help, so I tried adding :: to ::PHKEY in the clusapi.h file
and that seem to do the trick, I know we are not supposed to edit the source files,
but I don't think there is gonna be any more update to CB2009.

Thanks for helping
Best regards
Asger
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02