头孢克肟分散片儿童装:C++在#include命令中,用〈 〉和“”有什么区别?

来源:百度文库 编辑:高考问答 时间:2024/04/29 14:38:42

使用尖括号表示在包含文件目录中去查找(包含目录是由用户在设置环境时设置的),而不在源文件目录去查找; 使用双引号则表示首先在当前的源文件目录中查找,若未找到才到包含目录中去查找。

下面是MSDN的解释
""
This form instructs the preprocessor to look for include files in the same directory of the file that contains the #include statement, and then in the directories of any files that include (#include) that file. The preprocessor then searches along the path specified by the /I compiler option, then along paths specified by the INCLUDE environment variable.

<>
This form instructs the preprocessor to search for include files first along the path specified by the /I compiler option, then, when compiling from the command line, along the path specified by the INCLUDE environment variable.

"":运行前在同一目录文件下寻找需要包含的文件,然后沿着包含文件的路径运行INCLUDE的编译程序和环境变量等。
<>:运行前首先沿着/I编译选项寻找包含文件,然后当编译到命令行时,才编译INCLUDE的环境变量等。

上面的都是说的vc。
在C++标准中,<> 表示使用的库是标准库。因为标准库有多个版本,各版本的用的头文件是不同的,所以要求编译器对它有一些特殊的处理。它会把各个实现版本内容转化成标准的格式。至于如何做一家的编译器有一家的办法。

我们书上是写:
<>是指在指定的目录下找,不可能是自定义的;
" "是指首先在当前的源文件目录中找,若未找到再到包含目录中去找,可以是自定义的文件 。

<>在指定的目录下找,比如include,lib目录下

""先在制定目录下找,找不到就在当前目录下找

不一样.
用””查找的范围比<>的范围要大.