Vc中Source Files, Header Files, Resource Files,External Dependencies的作用

一、VC中Source Files, Header Files, Resource Files,External Dependencies的作用

Source Files 放源文件(.c、.cpp)程序的实现代码全放在这里
Header Files 放头文件(.h)声明放在这里
Resource Files 资源文件(.rc)放图标、图片、菜单、文字之类的,主要用来做界面的东东一般都放这里 External Dependencies 除上三种以外的,程序编译时用到的文件全放这里

二、头文件(header files)

        什么是头文件呢?C语言和C++的头文件有什么不一样呢?
        头文件(header files)又称作预编译文件,是用户应用程序和函数库之间的桥梁和纽带。作为一种包含功能函数、数据接口声明的载体文件,用于保存程序的声明,而定义文件用于保存程序的实现。
       头文件的主要作用在于调用库功能,对各个被调用函数给出一个描述,其本身不包含程序的逻辑实现代码,它只起描述性作用,告诉应用程序通过相应途径寻找相应功能函数的真正逻辑实现代码。用户程序只需要按照头文件中的接口声明来调用库功能,编译器会从库中提取相应的代码。
简单的说,头文件就是作者告诉程序从哪调用库函数的文件。
        头文件一般包括三个部分的内容:(1)版权和版本声明;(2)预处理块;(3)函数和类结构声明。而具体的结构可以试着打开一个现有的头文件看看。
        在标准C++中很多头文件都曾以“加.h”的方式在各种编译器中出现过,现在标准中规定的C++头文件都是没有“.h”后缀的。传统头文件(除输入输出外),文件名(<*.h>)前加上c (<c*>),就是相应的标准头了,其功能相同。而像string.h 与 string、limits.h 与 limits、locale.h 与locale这样的,功能却不完全相同。

        C语言头文件中定义了一些宏,这些宏在C++中仍然可以使用,但宏是不会隶属于任何命名空间的,使用进要分清标识符和宏。比如我们可以用std::time,但不能用std::assert,应该直接用assert。

三、C/C++头文件一览

1.C

#include <assert.h>    //设定插入点
#include <ctype.h>     //字符处理
#include <errno.h>     //定义错误码
#include <float.h>     //浮点数处理
#include <iso646.h>    //对应各种运算符的宏
#include <limits.h>    //定义各种数据类型最值的常量
#include <locale.h>      //定义本地化C函数
#include <math.h>      //定义数学函数
#include <setjmp.h>     //异常处理支持
#include <signal.h>    //信号机制支持
#include <stdarg.h>    //不定参数列表支持
#include <stddef.h>    //常用常量
#include <stdio.h>     //定义输入/输出函数
#include <stdlib.h>    //定义杂项函数及内存分配函数
#include <string.h>    //字符串处理
#include <time.h>     //定义关于时间的函数
#include <wchar.h>     //宽字符处理及输入/输出
#include <wctype.h>    //宽字符分类

2.传统C++

#include <fstream.h>    //改用<fstream>
#include <iomanip.h>    //改用<iomainip>
#include <iostream.h>   //改用<iostream>
#include <strstrea.h>   //该类不再支持,改用<sstream>中的stringstream

————————————————————————————————

3.标准C++ 

#include <algorithm>    //STL 通用算法
#include <bitset>     //STL 位集容器
#include <cctype>          //字符处理
#include <cerrno>      //定义错误码
#include <cfloat>      //浮点数处理
#include <ciso646>     //对应各种运算符的宏
#include <climits>     //定义各种数据类型最值的常量
#include <clocale>     //定义本地化函数
#include <cmath>      //定义数学函数
#include <complex>     //复数类
#include <csignal>     //信号机制支持
#include <csetjmp>     //异常处理支持
#include <cstdarg>     //不定参数列表支持
#include <cstddef>     //常用常量
#include <cstdio>      //定义输入/输出函数
#include <cstdlib>     //定义杂项函数及内存分配函数
#include <cstring>     //字符串处理
#include <ctime>      //定义关于时间的函数
#include <cwchar>      //宽字符处理及输入/输出
#include <cwctype>     //宽字符分类
#include <deque>      //STL 双端队列容器
#include <exception>    //异常处理类
#include <fstream>      //文件输入/输出
#include <functional>   //STL 定义运算函数(代替运算符)
#include <limits>      //定义各种数据类型最值常量
#include <list>      //STL 线性列表容器
#include <locale>      //本地化特定信息
#include <map>       //STL 映射容器
#include <memory>      //STL通过分配器进行的内存分配
#include <new>         //动态内存分配
#include <numeric>     //STL常用的数字操作
#include <iomanip>      //参数化输入/输出
#include <ios>       //基本输入/输出支持
#include <iosfwd>     //输入/输出系统使用的前置声明
#include <iostream>     //数据流输入/输出
#include <istream>     //基本输入流
#include <iterator>    //STL迭代器
#include <ostream>     //基本输出流
#include <queue>      //STL 队列容器
#include <set>       //STL 集合容器
#include <sstream>     //基于字符串的流
#include <stack>      //STL 堆栈容器
#include <stdexcept>    //标准异常类
#include <streambuf>    //底层输入/输出支持
#include <string>     //字符串类
#include <typeinfo>    //运行期间类型信息
#include <utility>     //STL 通用模板类
#include <valarray>    //对包含值的数组的操作
#include <vector>     //STL 动态数组容器

————————————————————————————————

4.C99增加的部分

#include <complex.h>   //复数处理
#include <fenv.h>    //浮点环境
#include <inttypes.h>  //整数格式转换
#include <stdbool.h>   //布尔环境
#include <stdint.h>   //整型环境
#include <tgmath.h>   //通用类型数学宏

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

azoo

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值