开发者

What does the .. in #include "../somefile.h" mean

Does it mean search the previous folder for somefile.h or the project folder for somefile.h开发者_C百科?


It means that look for somefile.h in the parent folder with respect to the source file where the include directive is found.

In *nix systems(thats where this convention came from AFAIK):

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

For example, if you have the following directories structure:

home
   |
   code
      | src
      | someOtherDirectory

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

#include "../somefile.h"

in your source code, then the compiler is going to look for somefile.h in home/code/


It means look in the parent directory for "somefile.h", relative to the directory the file containing the directive is in.


It means the parent directory of the directory the source file is in.


Well, if your source files are in /src, then somefile.h should be above src or in /

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜