[英]What does the .. in #include “../somefile.h” mean
是否意味着搜索somefile.h的上一个文件夹或somefile.h的项目文件夹?
It means that look for somefile.h
in the parent folder with respect to the source file where the include directive is found. 这意味着在父文件夹中查找somefile.h
,查找找到include指令的源文件。
In *nix systems(thats where this convention came from AFAIK): 在* nix系统中(这个约定来自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: 你的源文件可能在home/code/src
,你有:
#include "../somefile.h"
in your source code, then the compiler is going to look for somefile.h
in home/code/
在您的源代码中,然后编译器将在home/code/
查找somefile.h
这意味着在父目录中查找“somefile.h”,相对于包含该指令的文件所在的目录。
它表示源文件所在目录的父目录。
好吧,如果您的源文件在/src
,那么somefile.h
应该在src
之上或在/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.