What does .. in #include "../somefile.h" means

Does this mean looking for the previous folder for somefile.h or the project folder for somefile.h?

+3
source share
4 answers

This means that look somefile.hin the parent folder relative to the source file where the include directive is found.

On * nix systems (where this agreement was obtained from AFAIK):

.        manse the current directory.
..       means one level up from the current directory.

For example, if you have the following directory structure:

home
   |
   code
      | src
      | someOtherDirectory

Your source file may be in home/code/src, and you have:

#include "../somefile.h"

in the source code, then the compiler will search somefile.hinhome/code/

+14
source

"somefile.h" , , .

+3

This means the parent directory of the directory in which the source file is located.

+2
source

Well, if your source files are in /src, then it somefile.hshould be higher srcor in/

0
source

Source: https://habr.com/ru/post/1739044/


All Articles