#include<file.h>与#include"file.h"的区别
来源:互联网 发布:账目数据报表 编辑:程序博客网 时间:2024/03/29 08:51
对于这种问题先来看一看外国人怎么想的,因为本来这种语言就是他们创造的,http://www.geekinterview.com/question_details/3379
What is the difference between #include <file> and #include “file”?
When writing your C program, you can include files in two ways. The first way is to surround the file you want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable
INCLUDE=C:COMPILERINCLUDE;S:SOURCEHEADERS;
using the #include <file> version of file inclusion, the compiler first checks the C:COMPILERINCLUDE
directory for the specified file. If the file is not found there, the compiler then checks the
S:SOURCEHEADERS directory. If the file is still not found, the preprocessor checks the current directory.
The second way to include files is to surround the file you want to include with double quotation marks. This
method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up. Using the #include “file” version of file inclusion and applying
it to the preceding example, the preprocessor first checks the current directory for the specified file. If the
file is not found in the current directory, the C:COMPILERINCLUDE directory is searched. If the file
is still not found, the preprocessor checks the S:SOURCEHEADERS directory.
The #include <file> method of file inclusion is often used to include standard headers such as stdio.h or
stdlib.h. This is because these headers are rarely (if ever) modified, and they should always be read from your
compiler’s standard include file directory.
The #include “file” method of file inclusion is often used to include nonstandard header files that you have created for use in your program. This is because these headers are often modified in the current directory, and you will want the preprocessor to use your newly modified version of the header rather than the older, unmodified version.
总的来说:
当用#include“file.h”时,先搜索当前工作目录,如果没有,再去搜索库,库没有再搜索资源库;
当用#include<file.h>时,编译器先从标准库路径开始搜索,如果没再搜索资源库目录,最好搜索当前工作目录。
What is the difference between #include <file> and #include “file”?
When writing your C program, you can include files in two ways. The first way is to surround the file you want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable
INCLUDE=C:COMPILERINCLUDE;S:SOURCEHEADERS;
using the #include <file> version of file inclusion, the compiler first checks the C:COMPILERINCLUDE
directory for the specified file. If the file is not found there, the compiler then checks the
S:SOURCEHEADERS directory. If the file is still not found, the preprocessor checks the current directory.
The second way to include files is to surround the file you want to include with double quotation marks. This
method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up. Using the #include “file” version of file inclusion and applying
it to the preceding example, the preprocessor first checks the current directory for the specified file. If the
file is not found in the current directory, the C:COMPILERINCLUDE directory is searched. If the file
is still not found, the preprocessor checks the S:SOURCEHEADERS directory.
The #include <file> method of file inclusion is often used to include standard headers such as stdio.h or
stdlib.h. This is because these headers are rarely (if ever) modified, and they should always be read from your
compiler’s standard include file directory.
The #include “file” method of file inclusion is often used to include nonstandard header files that you have created for use in your program. This is because these headers are often modified in the current directory, and you will want the preprocessor to use your newly modified version of the header rather than the older, unmodified version.
总的来说:
当用#include“file.h”时,先搜索当前工作目录,如果没有,再去搜索库,库没有再搜索资源库;
当用#include<file.h>时,编译器先从标准库路径开始搜索,如果没再搜索资源库目录,最好搜索当前工作目录。
0 0
- #include<file.h>与#include"file.h"的区别
- #include<file.h>与#include"file.h"的区别
- #include<file.h>与#include“file.h”的区别
- #include<file.h>与#include "file.h"区别
- #incllude<file.h>与#include"file.h"
- 每日一题(13)—— #include<file.h> 与 #include “file”的区别
- #include "stdio.h"与 #include 的区别
- #include "stdio.h" 与#include的区别
- include file 与include virtual的区别
- include file 与 include page 的区别
- include file与include page的区别
- include file 与include virtual的区别
- include file 与include virtual的区别
- include file与jsp include 的区别
- #include "stdio.h " 与 #include <stdio.h> 的区别
- #include<iostream.h>与#include "iostream.h"的区别
- #include <filename.h>与#include“filename.h”的区别
- #include<head.h>与#include“head.h”的区别
- Metal 着色语言编程指南 十二
- linux系统编程之进程(四):进程退出exit,_exit区别即atexit函数
- Bluetooth蓝牙
- windows脚本设置ip
- KMP算法的next[]数组通俗解释
- #include<file.h>与#include"file.h"的区别
- 二叉树平摊
- 仿QQ项目(一):好友列表
- 在线编程--输出单向链表中倒数第k个结点
- SQL Server CDC Admin & Monitor
- TCP协议中的三次握手和四次挥手(图解)
- 尝试 ES6 中的箭头函数
- #leetcode#231. Power of Two
- C++实验4:百钱买百鸡问题