I am using a C++ third party library that places all of its classes in a versioned namespace, let's call it tplib_v44
. They also define a generic namespace alias:
namespace tplib = tplib_v44;
If a forward-declare a member of the library in my own .h file using the generic namespace...
namespace tplib { class SomeClassInTpLib; }
... I get compiler errors on the header in the third-party library (which is being included later in my .cpp implementation file):
error C2386: 'tplib' : a symbol with this name already exists in the current scope
If I use the version-specific namespace, then everything works fine, but then ... what's the point? What's the best way to deal with this?
[EDIT] FYI for future viewers, this was the ICU library. A solution (at least in my situation) is in the comments to the accepted answer.