Search code examples
c++visual-c++dllheader-filesglog

Why using this library needs its internal headers?


I have a library A.dll that used google logging library(glog). Now I want to use this library in another project,in my own project I don't want to use glog. I want to just use A.dll, but during compilation, the compiler says that can't find logging.h header!!!

Why this happens?! it is a header that A.dll uses internally and I want to use A's interface not glog. I think that it is enough to include A.h, I don't need logging.h . Am I wrong? any idea that what is the problem?

A.dll is built with MSVC++ 2015 and I am using MSVC++ 2015 in QT Creator.


Solution

  • You haven't included evidence of how and where the glog header files are included in A library.
    But we may suppose it is #included in one of the public library header files, that your project includes to use the library, so you inderectly get the glog headers dependency.

    One of the reasons is that the developers of A library did a bad job and failed in hiding the internal only dependencies.

    How to overcame the indirect include dependency?
    It depends on how the A library headers are written and if you or the original A library developers can change it to avoid exposure of the internal dependency.