directoryincludeinclude-path

Including a file outside of local directory


I have a project, laid out like this.

/Project Folder
    /Header file
    /Sub folder
        /Sub folder
           /Source file

If I want to include the header file in the source file, what path would I use inside of #include ""?

I am using Visual Studio 2022, with C++.


Solution

  • I figured this out with the help of some friends. if your target file is one directory out, then you would #include "../targetFile.h" for two it would be #include "../../targetFile.h" and so on.