I'm attempting to switch a large project to using C++11. I ran into large number of linker errors which seem caused by the mismatched namespace on STL classes between library compiled with C++11 and those compiled with C++03.
As an example, say library B is a dependency of A. B has following templated class as part of its interface.
template <class Type>
class VectorParameter
{
public:
VectorParameter();
virtual ~VectorParameter();
...
}
Library A instantiates the template with VectorParameter<std::pair<float, float>>
.
When I recompiled A with C++11 without recompiling B, I ran into linker error that complains that
LFE::VectorParameter<std::__1::pair<float, float>>::~VectorParameter() is undefined symbol.
I think the issue here is that library A uses std::__1::pair
while B still uses std::pair
. Following this reasoning, I assume that I will need to recompile all dependency libraries that refers STL types in their interfaces.
If this is the case, then migrating a large project to C++11 will require all involved groups to switch at the same time, which doesn't seem very practical on a complex project. What would be the best practice for dealing this issue?