What are the requirements for include header files and project dependencies ?
This seems like a very basic question, but I am trying to get to the essence of the problem. (Purpose: design, refactoring, possible automation).
I have seen different types of headers:
<c++ standard headers>
<core library headers>
<external library headers>
<local project headers>
- If I look at an “include” directory, how do I recognize that a header
is a C++ standard header ?
[There used to be a location, in Options or somewhere, to show paths to references. I can’t find it anymore. Does it still exist ?]
-
If I include an external library header (library-type project), I typically have to do all of the following:
a) give my project knowledge of the location of “include” files
b) link the lib
c) add the project as a dependency, in the
solution.
I prefer to do a) and b) through property sheet references. The property sheet of the dependent library has, of course, the list of dependencies, library directories, include directories. (Do I have to do all 3 steps ?)
- If I include “core library headers” like boost, I don’t need to include any of the boost projects in my solution (I do have a property sheet for boost that tells my project where required files are).
Why ??????
How can I tell when I must add the project to the solution as a dependency ?
When do I have to add the lib as a dependency ? (Or, in other words, why don’t I have to add libs like boost as dependency ?)
Do these libraries have something special, so that I don’t have to include them ?
What must I do when creating a library, to make it so that it does not have to be included in every solution that uses its header files, as a dependency ?
The answer to my question – so I don’t leave it unanswered – is quite simple: it is a matter of choice !
I will choose to include other projects to the solution, if at some point they can be modified and a change to those projects may require them to be rebuilt, therefore affecting the project I am working on.
I will not include any projects, like third-party, open-source libraries (example: boost), which are unlikely to change.
One of the other items in question: where are the C++ standard headers… There is an environment variable
$(INCLUDE)that shows the paths to the included directories. Unfortunately, it is not set as a System Environment Variable… Not sure how it can be accessed through code.