0

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.

payman
  • 300
  • 2
  • 15
  • 1
    If A.dll depends on another library, then you simply can't take away that dependency without rebuilding A.dll to work without that dependency. – Some programmer dude Feb 01 '17 at 10:55
  • I have glog library and have configured my project to find glog dll. I have logging.h and all other glog headers. But my question is that why the compiler needs glog headers in my project? – payman Feb 01 '17 at 11:00
  • Probably one of the A.dll header files needs it? – Some programmer dude Feb 01 '17 at 11:11
  • @Someprogrammerdude : Yes, It is obvious, but it needs glog for its internal usage, logging is not in the interface of A. Are the client code needs all of the headers that are used in library code? I don't think so. – payman Feb 01 '17 at 11:19
  • Because header contain functions' prototypes, some global variables while libraries have the definitions so you only include these headers and link against those libraries. – Raindrop7 Feb 01 '17 at 11:45

1 Answers1

1

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.

roalz
  • 2,699
  • 3
  • 25
  • 42