I have in my own code an namespace core that is conflicting with the namespace core of a dynamic library that I am using. The problem appears because I can not modify neither one nor the other. The first core because is part of our team project, and the second because is part of the library. Is there a way to solve this situation?
Try turning your core namespace into a sub namespace.
EDIT: Cleaned up answer and added code. (Hard to do on mobile!)
This way you can get access to each 'core' namespace. This also explicitly shows which 'core' is being referred to. Even if the external library has the same function names you will be safe.
However, you mentioned that you can't actually change anything in the original code, so your only option is to use a different library and hope it doesn't have a 'core' namespace in it. Seems to me like it might be alot easier to convince your team to change their code.
// Your 'core' namespace, inside your own namespace.
namespace Mygame
{
namespace core
{
void Foo();
}
}
// Access both namespaces safely.
Mygame::core::Foo();
core::Foo();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With