Im building a shared library which itself has a dependency on another shared library. These dependencies are not exposed by the library, for example
In Library A:
class MySubDependencyClass{
}
In Library B:
class MyLibraryClass{
public:
void foo(){
mySubDependencyClass.foo()
}
private:
MySubDependencyClass mySubDependencyClass;
}
In my Application:
class MyAppClass{
MyLibraryClass myLibrary class
}
The dependency chain looks like this MyApp -> MyLibrary ->MySubDependency
When building MyApp at the moment I have to link the subdependencies as well as the direct dependency. Is there any way to get around this? It seems very unelegant.
I found this link: Linking with dynamic library with dependencies but couldn't understand if the issue was resolved or not
My IDE is qtcreator.
EDIT:
I have now forward declared the subdependency
In Library B:
class MySubDependencyClass;
class MyLibraryClass{
public:
void foo(){
mySubDependencyClass.foo()
}
private:
MySubDependencyClass mySubDependencyClass;
}
and this works, is this the way to go? What is the "standard" way of dealing with this?