In our project (C++14) we have divided our software into several components by a functional breakdown of the system. Each of the modules reside in their own namespace embedded in a common namespace for the system. We use CMake as our build system and each component is a static library that can be built separately and is linked together at the end.
Now, in many components specific data types are defined, as class or struct e.g. for time, a collection of data fields to be processed together and so on. These data structures are defined locally at the component where the data they contain is created.
But. When I now have to access one of these data structures from other components I have to include the header from the specific component and have a dependency between these two components. And as this is a common approach, we have many dependencies between our software components easily leading to cyclic dependencies. :(
In the C world I would have created a GlobalDataStructures.h
and added all the data structures that are used throughout the software system.
What is the (modern) C++ approach to this? What are best practices?