繁体   English   中英

#include“../somefile.h”中的..是什么意思

[英]What does the .. in #include “../somefile.h” mean

是否意味着搜索somefile.h的上一个文件夹或somefile.h的项目文件夹?

这意味着在父文件夹中查找somefile.h ,查找找到include指令的源文件。

在* nix系统中(这个约定来自AFAIK):

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

例如,如果您具有以下目录结构:

home
   |
   code
      | src
      | someOtherDirectory

你的源文件可能在home/code/src ,你有:

#include "../somefile.h"

在您的源代码中,然后编译器将在home/code/查找somefile.h

这意味着在父目录中查找“somefile.h”,相对于包含该指令的文件所在的目录。

它表示源文件所在目录的父目录。

好吧,如果您的源文件在/src ,那么somefile.h应该在src之上或在/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM