I've just finished building a program in which I have a main.cpp file and my own static library, let's call it myLib and it's made from myLib.h and a myLib.cpp files.
myLib.h and myLib.cpp make a static library.
In my static library, I make use of some boost functions and classes so as my own classes and functions in myLib.cpp can do some things: so in myLib.cpp I add the lines
#include <boost/math/distributions/binomial.hpp>
#include <boost/math/tools/roots.hpp>
to myLib.cpp
Now myLib.h contains function declarations, and some class definitions, myLib.cpp has the implementation of those functions and class definitions, and since some of the functions, require the classes declared in myLib.h, #include "myLib.h" must also be added to the myLib.cpp file (I suspect that if those functions did not, then myLib.cpp could be compiled as an object file without the myLib.h file needing to be included so long as whatever uses the object file does include myLib.h - but since some functions use the classes, myLib.cpp also includes myLib.h). Is it acceptable for the implementation file to require the header file for compilation as an object file (and then inclusion into a .a file)? I can't quite fathom if this is bad or not - I thought the idea was they are supposed to be separate?