#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
和#include对程序的运行有什么不同?
? ? ? ? A:没有区别
2.?
? ? ? ? Q:#include后加using namespace std; 和直接用#include在运行上有什么区别?
? ? ? ? A:#include是早些时候的形式
? ? ? ? ? ? ? ? 最新的标准定义的是
? ? ? ? ? ? ? ? #include
? ? ? ? ? ? ? ? using namespace std;
?
? ? ? ? ? ? ? ? 比如#include变成
? ? ? ? ? ? ? ? #include
? ? ? ? ? ? ? ? using namespace std;
?
? ? ? ? ? ? ? ? #include变成
? ? ? ? ? ? ? ? #include
? ? ? ? ? ? ? ? using namespace std;
?
?
?