c++中#include<>中都能加什么?有什么用?
2016-10-05 15:25
369 查看
这里需要注意include的两种不同写法,#include<***.h>和#include"***.h" 采用"< >"方式进行包含的头文件表示让编译器在编译器的预设标准路径下去搜索相应的头文件,如果找不到则报错。 例如:VS2008的安装目录\Microsoft Visual Studio 9.0\VC\include下面就包含了标准库的头文件。 第二种方式表示先在工程所在路径下搜索,如果失败,再到系统标准路径下搜索。 所以,特别要注意的是,如果是标准库头文件,那么既可以采用<>的方式,又可以采用" "的方式,而用户自定义的头文件只能采用" "的方式。 例如,如下这种方式是正确的: #include <iostream> 效率较高 #include "iostream" 效率较低 如下这种方式是不正确的: #include<diy.h> diy.h是我们自己创建的头文件 安装问题中的格式,能加的所有文件如下: A、传统 C++: #include <assert.h> //设定插入点 #include <ctype.h> //字符处理 #include <errno.h> //定义错误码 #include <float.h> //浮点数处理 #include <fstream.h> //文件输入/输出 #include <iomanip.h> //参数化输入/输出 #include <iostream.h> //数据流输入/输出 #include <limits.h> //定义各种数据类型最值常量 #include <locale.h> //定义本地化函数 #include <math.h> //定义数学函数 #include <stdio.h> //定义输入/输出函数 #include <stdlib.h> //定义杂项函数及内存分配函数 #include <string.h> //字符串处理 #include <strstrea.h> //基于数组的输入/输出 #include <time.h> //定义关于时间的函数 #include <wchar.h> //宽字符处理及输入/输出 #include <wctype.h> //宽字符分类 B、标准 C++ (与上方相同的文件不再注释) #include <algorithm> //STL 通用算法 #include <bitset> //STL 位集容器 #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> //复数类 #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> //STL 双端队列容器 #include <exception> //异常处理类 #include <fstream> #include <functional> //STL 定义运算函数(代替运算符) #include <limits> #include <list> //STL 线性列表容器 #include <map> //STL 映射容器 #include <iomanip> #include <ios> //基本输入/输出支持 #include <iosfwd> //输入/输出系统使用的前置声明 #include <iostream> #include <istream> //基本输入流 #include <ostream> //基本输出流 #include <queue> //STL 队列容器 #include <set> //STL 集合容器 #include <sstream> //基于字符串的流 #include <stack> //STL 堆栈容器 #include <stdexcept> //标准异常类 #include <streambuf> //底层输入/输出支持 #include <string> //字符串类 #include <utility> //STL 通用模板类 #include <vector> //STL 动态数组容器 #include <cwchar> #include <cwctype> C、C99 增加的: #include <complex.h> //复数处理 #include <fenv.h> //浮点环境 #include <inttypes.h> //整数格式转换 #include <stdbool.h> //布尔环境 #include <stdint.h> //整型环境 #include <tgmath.h> //通用类型数学宏
相关文章推荐
- ProgrammerInterview(C++中,#include""和#include<>的区别是什么?)
- #include <tchar.h> 是什么意思
- C语言中#include 后面没有<>或者“”是什么意思?解决办法
- c++中#include <>与#include""
- #include<queue> 【c++】
- c/c++中#include <>与#include""区别
- C++中#include包含头文件带 .h 和不带 .h 的区别,如<iostream>和<iostream.h>
- c/c++中#include <>与#include""区别
- c++中#include <>与#include""
- c/c++中#include <>与#include""区别
- c/c++中#include <>与#include""区别
- C语言中两种方式使用#include命令,#include <>与#include ””的区别是什么?
- include <>和 include ""有什么区别
- #include<> C/C++ 头文件
- C++中include <iostream>和include <iostream.h>的区别
- #include <filename.h> 和 #include “filename.h”有什么 区别
- Why do we need extern “C”{ #include <foo.h> } in C++?
- #include <stdlib.h> 这个头文件是什么作用?
- C++中#include<iostream.h>和#include<iostream>
- C++关于std namespace与# include<iostream>关系的有关问题