包括“file.h” vs< file>有什么不同? [英] include "file.h" vs <file> what is the difference?
问题描述
我在Visual Studio 2010中工作。我在Project Properties中添加了一个目录 - > Linker - > General - > Additional Directories
I'm working in Visual studio 2010. I Added a directory to Project Properties -> Linker -> General -> Additional Directories
如果我使用项目编译
"file.h"
但不是如果我使用
<file>
推荐答案
您可能假设 < >
隐式地将 .h
添加到文件名的末尾。这不是真的。是否使用< >
或对文件名无意义。它基本上告诉实现它应该遍历的顺序包括查找头文件的目录。
You are probably assuming that < >
implicitly adds .h
to the end of the file name. This is not true. Whether you use < >
or " "
has no significance on the name of the file. It basically tells the implementation in which order it should traverse include directories to find the header file.
引用标准:
形式的预处理指令
#include< h-char-sequence> new-line
搜索一系列实现定义的地方,查找由<
和>
分隔符,并使标头的全部内容替换该指令。如何指定地点或识别标题是实现定义的。
A preprocessing directive of the form
# include <h-char-sequence> new-line
searches a sequence of implementation-defined places for a header identified uniquely by the specified sequence between the<
and>
delimiters, and causes the replacement of that directive by the entire contents of the header. How the places are specified or the header identified is implementation-defined.
形式的预处理指令
#includeq-char-sequencenew-line
导致由分隔符之间的指定序列标识的源文件的全部内容替换该指令。文件以实现定义的方式搜索。如果不支持此搜索,或者搜索失败,则重新处理该指令,就好像它已读取
A preprocessing directive of the form
# include "q-char-sequence" new-line
causes the replacement of that directive by the entire contents of the source file identified by the specified sequence between the "
delimiters. The named source file is searched for in an implementation-defined manner. If this search is not supported, or if the search fails, the directive is reprocessed as if it read
#include< h-char-sequence> new-line
包含相同的序列(包括> $ c $原始指令中的c>字符(如果有)
这篇关于包括“file.h” vs< file>有什么不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!