Reputation: 3509
I have a solution with 2 projects in it:
In the FunctionLIB I use two APIs for external hardware, called SDK1.h and SDK2.h
The lib is linked by the GUI, but the GUI only includes the FunctionLIB.h
When building the lib, the headers are found since the include directories are set properly. But when compiling the GUI, which uses the LIB functions, I get include files not found. I have to add the include directories to the GUI directories as well.
Why is that so? The LIB finds it just fine, but the GUI indirectly throws an error, and I do not understand why it would need those includes in the first place.
Upvotes: 0
Views: 1620
Reputation: 409176
If you make a library, you should have one (or more) public header files, that are included by the code that needs your library. However, these public header files should try not to include any external libraries used internally by the you library.
In your case, it might be enough to create two header files for your library. One public, and one private that includes the public header file and the external header files. Then in your library you only include the private header file.
Upvotes: 2