#include<>

        使用尖括号表示在包含文件目录中去查找(包含目录是由用户在设置环境时设置的),而不在源文件目录去查找; 


#include""

        使用双引号则表示首先在当前的源文件目录中查找,若未找到才到包含目录中去查找;


MSDN的相关说明
        #include""

                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.

        #include<>
                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.


扩展知识

1. 

        Q:C++中的预处理#include<iostream>和#include<iostream.h>对程序的运行有什么不同?

        A:没有区别

2. 

        Q:#include<iostream>后加using namespace std; 和直接用#include<iostream.h>在运行上有什么区别?

        A:#include<iostream.h>是早些时候的形式

                最新的标准定义的是
                #include<iostream>
                using namespace std;

                比如#include<math.h>变成
                #include<cmath>
                using namespace std;
 
                #include<string.h>变成
                #include<cstring>

                using namespace std;

from:http://blog.csdn.net/xiaoting451292510/article/details/12562363

 posted on 2014-04-08 23:39  mnmlist1  阅读(283)  评论(0编辑  收藏  举报