C++ Resolving conflicts with legacy unnamed namesp

2019-09-02 11:58发布

问题:

I have a large body of legacy code which declares a number of important types. For example:

typedef uint32 EventId;

I'm currently integrating an excellent new version of 3rd party code (Scaleform) which has namespaces, but has conflicting definitions:

namespace Scaleform { namespace GFx {
class EventId ...
}}

There is code where both definitions are encountered, and I of course get errors:

error: reference to 'EventId' is ambiguous

note: candidate found by name lookup is 'EventId'

note: candidate found by name lookup is 'Scaleform::GFx::EventId'

(OSX Clang, BTW)

As far as I can tell, I'm kind of SOL, since C++ forbids these sorts of collisions, and I can't (for example) wrap legacy references with something like :

using namespace;

To force the unnamed namespace.

My only recourse is to rename one of the types so there's no conflict, correct?

标签: c++ clang