Search code examples
c++visual-studiovisual-c++-2005

Including header files in Visual Studio


Suppose I have a solution with 3 projects X,Y, and E.

E will generate an executable and X and Y will generate static libraries such that Y includes the header files of X and E includes the header files of Y.

Now, my question is: why do I have to include the directory of the header files of X in E?


Solution

  • Here's why:

    1. It is possible that some function in project Y takes an argument (or returns a value) which is of a type declared in X.
    2. If so, the compiler may have to create these argument (or return value) objects while compiling E.
    3. If that's the case, header files from X are absolutely needed in E.