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>,尖括号里面的不一定是个文件名

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

 

posted @ 2013-06-08 17:19  ttang  阅读(1770)  评论(0编辑  收藏  举报