include用尖括号还是双引号,C++

http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename

The sequence of characters between < and > uniquely refer to a header, which isn't necessarily a file. Implementations are pretty much free to use the character sequence as they wish. (Mostly, however, just treat it as a file name and do a search in the include path, as the other posts state.)

If the #include "file" form is used, the implementation first looks for a file of the given name, if supported. If not (supported), or if the search fails, the implementation behaves as though the other (#include <file>) form was used.

Also, a third form exists and is used when the #include directive doesn't match either of the forms above. In this form, some basic preprocessing (such as macro expansion) is done on the "operands" of the #include directive, and the result is expected to match one of the two other forms.

--

The simple general rule is to Use angled brackets to include header files that come with the compiler. Use double quotes to include any other header files.

简单地说,系统头文件用尖括号,比如#include <iostream>,尖括号里面的不一定是个文件名

其他的(自己写的头文件,下载的包等)用双引号

 

原文链接: https://www.cnblogs.com/fstang/archive/2013/06/08/3127143.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    include用尖括号还是双引号,C++

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/91622

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月10日 上午1:15
下一篇 2023年2月10日 上午1:16

相关推荐